mirror of
https://github.com/lukevella/rallly.git
synced 2025-07-19 17:27:26 +02:00
♻️ Switch to using new startTime column (#1041)
This commit is contained in:
parent
bbbbf5ff49
commit
a3e26bcc9a
7 changed files with 57 additions and 137 deletions
|
@ -18,7 +18,8 @@ import { DateIcon } from "@/components/date-icon";
|
|||
import { useParticipants } from "@/components/participants-provider";
|
||||
import { ConnectedScoreSummary } from "@/components/poll/score-summary";
|
||||
import { VoteSummaryProgressBar } from "@/components/vote-summary-progress-bar";
|
||||
import { useDateFormatter, usePoll } from "@/contexts/poll";
|
||||
import { usePoll } from "@/contexts/poll";
|
||||
import { useDayjs } from "@/utils/dayjs";
|
||||
|
||||
const formSchema = z.object({
|
||||
selectedOptionId: z.string(),
|
||||
|
@ -69,6 +70,7 @@ export const FinalizePollForm = ({
|
|||
const poll = usePoll();
|
||||
const [max, setMax] = React.useState(pageSize);
|
||||
|
||||
const { adjustTimeZone } = useDayjs();
|
||||
const scoreByOptionId = useScoreByOptionId();
|
||||
const { participants } = useParticipants();
|
||||
|
||||
|
@ -96,7 +98,6 @@ export const FinalizePollForm = ({
|
|||
return { ...option, votes: scoreByOptionId[option.id] };
|
||||
});
|
||||
|
||||
const dateFormatter = useDateFormatter();
|
||||
const form = useForm<FinalizeFormData>({
|
||||
defaultValues: {
|
||||
selectedOptionId: options[0].id,
|
||||
|
@ -127,10 +128,16 @@ export const FinalizePollForm = ({
|
|||
className="grid gap-2"
|
||||
>
|
||||
{options.slice(0, max).map((option) => {
|
||||
const start = dateFormatter(option.start);
|
||||
const end = dateFormatter(
|
||||
dayjs(option.start).add(option.duration, "minute"),
|
||||
const start = adjustTimeZone(
|
||||
option.startTime,
|
||||
!poll.timeZone,
|
||||
);
|
||||
|
||||
const end = adjustTimeZone(
|
||||
dayjs(option.startTime).add(option.duration, "minute"),
|
||||
!poll.timeZone,
|
||||
);
|
||||
|
||||
return (
|
||||
<label
|
||||
key={option.id}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue