-
Notifications
You must be signed in to change notification settings - Fork 1
C13/14 #366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: stage
Are you sure you want to change the base?
C13/14 #366
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,14 @@ const { student, settings, updateExp } = useCurrentStudent() | |
| const { FormGroup } = useCurrentFormGroup() | ||
| const { tickets, completedFormIds, logFormSubmission, logSubmissionResponse } = useCurrentStudentProgress() | ||
|
|
||
| //parse a date string (ISO or YYYY-MM-DD) into a local-midnight Date to avoid timezone shift when displaying weekday/day of month | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can do this with cleaner with dayjs library. dayjs(date).format('YYYY-MM-DD'). Also, this function (with dayjs implemented) is already used in useAdmin from Swarna's incoming pr. It should be pulled from there. I'll make her extract the date logic to its own composable for clearer use across both reader and admin
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ^^^^essentially, wait for date logic changed pr to be merged into main and then use those functions here |
||
| function toLocalDate(dateStr: string): Date { | ||
| //extract the YYYY-MM-DD | ||
| const ymd = dateStr.split('T')[0] | ||
| const [y, m, d] = ymd.split('-').map(Number) | ||
| return new Date(y, m - 1, d) | ||
| } | ||
|
|
||
| const stats = computed(() => ({ | ||
| xp: student.value ? student.value.exp : 0, | ||
| tickets: tickets.value? tickets.value : 0, | ||
|
|
@@ -266,14 +274,14 @@ function getBadgeClass(type: string) { | |
| ? 'background:#f59e0b; color:white' | ||
| : 'background:rgba(224,96,77,0.1); color:var(--brand-indigo)'" | ||
| > | ||
| <span class="text-[9px] uppercase leading-none">{{ new Date(form.startDate).toLocaleDateString('en-US', {weekday:'short'}) }}</span> | ||
| <span class="text-lg font-black leading-tight">{{ new Date(form.startDate).getDate() }}</span> | ||
| <span class="text-[9px] uppercase leading-none">{{ toLocalDate(form.startDate).toLocaleDateString('en-US', {weekday:'short'}) }}</span> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. make sure to update the actual calls to the function once other work implemented |
||
| <span class="text-lg font-black leading-tight">{{ toLocalDate(form.startDate).getDate() }}</span> | ||
| </div> | ||
| <div> | ||
| <h4 class="font-heading text-lg font-bold" style="color:var(--brand-dark)">{{ form.title }}</h4> | ||
| <div class="flex items-center gap-2 mt-0.5"> | ||
| <p class="text-xs font-bold text-gray-400"> | ||
| {{ new Date(form.startDate).toLocaleDateString('en-US', {weekday:'long'}) }} • | ||
| {{ toLocalDate(form.startDate).toLocaleDateString('en-US', {weekday:'long'}) }} • | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as previous comment |
||
| {{ (FormGroup.formComponents[form.id] || []).length }} Steps | ||
| </p> | ||
| <span v-if="completedFormIds.includes(form.id)" class="text-xs font-black px-2 py-0.5 rounded-full" style="color:var(--brand-mint); background:rgba(45,212,191,0.15)">✓ Done</span> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this even used?