-
-
Notifications
You must be signed in to change notification settings - Fork 1
fix: auto join tenant #220
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
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 |
|---|---|---|
|
|
@@ -15,6 +15,8 @@ import { Badge } from "@/components/ui/badge"; | |
| import { EventActions } from "./EventActions"; | ||
| import { cn } from "@/lib/utils"; | ||
| import { useTranslation } from "react-i18next"; | ||
| import { AddToGoogleCalendarLink } from "@/components/shared/AddToGoogleCalendarLink"; | ||
| import { combineDateAndTimeLocal, parseISODateLocal } from "@/lib/googleCalendar"; | ||
|
|
||
| interface EventCardProps { | ||
| event: EventWithGroups; | ||
|
|
@@ -46,29 +48,60 @@ export function EventCard({ | |
| timeDisplay = `${t("events:endsAt")} ${event.end_time}`; | ||
| } | ||
|
|
||
| const calendarLabel = t("events:addToGoogleCalendar"); | ||
| const hasAnyTime = !!event.start_time || !!event.end_time; | ||
| const calendarStart = hasAnyTime | ||
| ? ((event.start_time && combineDateAndTimeLocal(event.date, event.start_time)) ?? | ||
| parseISODateLocal(event.date) ?? | ||
| new Date()) | ||
| : (parseISODateLocal(event.date) ?? new Date()); | ||
| const calendarEnd = hasAnyTime | ||
| ? ((event.end_time && combineDateAndTimeLocal(event.date, event.end_time)) ?? | ||
| new Date(calendarStart.getTime() + 60 * 60 * 1000)) | ||
| : calendarStart; | ||
|
Comment on lines
+53
to
+61
|
||
| const calendarDetails = [ | ||
| event.description ?? "", | ||
| event.event_link ? `\n\n${event.event_link}` : "", | ||
| ].join(""); | ||
|
|
||
| return ( | ||
| <Card className={cn("relative", event.visibility === "private" && "border-primary/30")}> | ||
| {isEditable && ( | ||
| <EventActions | ||
| event={event} | ||
| onEventUpdated={onEventUpdated} | ||
| onDeleteEvent={onDeleteEvent} | ||
| onCopyEvent={onCopyEvent} | ||
| allGroups={allGroups} | ||
| /> | ||
| )} | ||
|
|
||
| <CardHeader> | ||
| <CardTitle>{event.name}</CardTitle> | ||
| <CardDescription className="flex items-center gap-1"> | ||
| <Calendar className="h-4 w-4" /> {formattedDate} | ||
| {hasTime && ( | ||
| <> | ||
| <span className="mx-1">•</span> | ||
| <Clock className="h-4 w-4" /> {timeDisplay} | ||
| </> | ||
| )} | ||
| </CardDescription> | ||
| <div className="flex items-start justify-between gap-3"> | ||
| <div className="min-w-0"> | ||
| <CardTitle className="truncate">{event.name}</CardTitle> | ||
| <CardDescription className="flex items-center gap-1"> | ||
| <Calendar className="h-4 w-4" /> {formattedDate} | ||
| {hasTime && ( | ||
| <> | ||
| <span className="mx-1">•</span> | ||
| <Clock className="h-4 w-4" /> {timeDisplay} | ||
| </> | ||
| )} | ||
| </CardDescription> | ||
| </div> | ||
| <div className="flex shrink-0 items-center gap-2"> | ||
| <AddToGoogleCalendarLink | ||
| title={event.name} | ||
| start={calendarStart} | ||
| end={calendarEnd} | ||
| isAllDay={!hasAnyTime} | ||
| details={calendarDetails} | ||
| label={calendarLabel} | ||
| className="px-0" | ||
| /> | ||
| {isEditable && ( | ||
| <EventActions | ||
| className="shrink-0" | ||
| event={event} | ||
| onEventUpdated={onEventUpdated} | ||
| onDeleteEvent={onDeleteEvent} | ||
| onCopyEvent={onCopyEvent} | ||
| allGroups={allGroups} | ||
| /> | ||
| )} | ||
| </div> | ||
| </div> | ||
| </CardHeader> | ||
|
|
||
| {event.description && ( | ||
|
|
@@ -77,36 +110,34 @@ export function EventCard({ | |
| </CardContent> | ||
| )} | ||
|
|
||
| {(event.event_link || (event.groups && event.groups.length > 0)) && ( | ||
| <CardFooter className="flex flex-wrap gap-2"> | ||
| {event.event_link && ( | ||
| <a | ||
| href={event.event_link} | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| className="text-sm text-primary underline hover:no-underline" | ||
| > | ||
| {t("events:eventLinkText")} | ||
| </a> | ||
| )} | ||
|
|
||
| {event.groups && | ||
| event.groups.length > 0 && | ||
| event.groups.map((group) => | ||
| group ? ( | ||
| <Badge key={group.id} variant="outline"> | ||
| {group.name} | ||
| </Badge> | ||
| ) : null, | ||
| )} | ||
| <CardFooter className="flex flex-wrap gap-2"> | ||
| {event.event_link && ( | ||
| <a | ||
| href={event.event_link} | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| className="text-sm text-primary underline hover:no-underline" | ||
| > | ||
| {t("events:eventLinkText")} | ||
| </a> | ||
| )} | ||
|
|
||
| {event.visibility === "private" && ( | ||
| <Badge variant="secondary" className="ml-auto"> | ||
| {t("events:private")} | ||
| </Badge> | ||
| {event.groups && | ||
| event.groups.length > 0 && | ||
| event.groups.map((group) => | ||
| group ? ( | ||
| <Badge key={group.id} variant="outline"> | ||
| {group.name} | ||
| </Badge> | ||
| ) : null, | ||
| )} | ||
| </CardFooter> | ||
| )} | ||
|
|
||
| {event.visibility === "private" && ( | ||
| <Badge variant="secondary" className="ml-auto"> | ||
| {t("events:private")} | ||
| </Badge> | ||
| )} | ||
| </CardFooter> | ||
|
Comment on lines
+113
to
+140
|
||
| </Card> | ||
| ); | ||
| } | ||
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.
The flow parameter is now being preserved in the OAuth redirect, but there's no validation that the flow parameter is a valid AuthFlowStep value. If a malformed or invalid flow parameter is passed, it could cause unexpected behavior in the auth flow. Consider adding validation to ensure the flow parameter is one of the expected values before preserving it.