Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

✨ Show a Join link next to the poll's conferencing label (#3376)

Luke Vella55b23e5f5b27
diff --git a/apps/web/public/locales/en/app.json b/apps/web/public/locales/en/app.json
index 9e064165b..9940543c0 100644
--- a/apps/web/public/locales/en/app.json
+++ b/apps/web/public/locales/en/app.json
@@ -472,6 +472,7 @@
"jobTitleRecruiter": "Recruiter",
"jobTitleSales": "Sales",
"jobTitleTeacherOrLecturer": "Teacher or lecturer",
+ "joinMeeting": "Join",
"joinSpace": "Join {spaceName}",
"keyBenefits": "Key benefits",
"language": "Language",
diff --git a/apps/web/src/features/conferencing/components/poll-conferencing-summary.tsx b/apps/web/src/features/conferencing/components/poll-conferencing-summary.tsx
index 12d66921f..dab844e07 100644
--- a/apps/web/src/features/conferencing/components/poll-conferencing-summary.tsx
+++ b/apps/web/src/features/conferencing/components/poll-conferencing-summary.tsx
@@ -7,48 +7,54 @@ import { conferencingProviderLabels } from "@/features/conferencing/utils";
import { Trans } from "@/i18n/client";
// What the organizer asked for, as shown on the poll page. A provider has no
-// link until the poll is finalized, so it shows as the service name; a
-// pasted link is already joinable.
+// link until the poll is finalized and the meeting is minted; a pasted link
+// is joinable from the start.
export function PollConferencingSummary({
conferencing,
+ meetingUri,
}: {
conferencing: PollConferencing;
+ meetingUri?: string | null;
}) {
- if (conferencing.provider === "custom") {
- if (!conferencing.uri) {
- return (
+ const joinUri =
+ meetingUri ??
+ (conferencing.provider === "custom" ? conferencing.uri : undefined);
+
+ return (
+ <>
+ {conferencing.provider === "custom" ? (
<>
<VideoIcon />
<span className="truncate">{conferencing.label}</span>
</>
- );
- }
- return (
- <>
- <VideoIcon />
- <a
- href={conferencing.uri}
- target="_blank"
- rel="noopener noreferrer"
- className="group inline-flex min-w-0 items-center gap-1 hover:text-foreground"
- >
- <span className="truncate">{conferencing.label}</span>
- <ArrowUpRightIcon
- aria-hidden="true"
- className="transition-colors group-hover:text-foreground"
+ ) : (
+ <>
+ <ConferencingProviderIcon
+ provider={conferencing.provider}
+ size={16}
/>
- <span className="sr-only">
- <Trans i18nKey="opensInNewTab" defaults="(opens in new tab)" />
+ <span>{conferencingProviderLabels[conferencing.provider]}</span>
+ </>
+ )}
+ {joinUri ? (
+ <>
+ <span aria-hidden="true" className="text-muted-foreground">
+ ·
</span>
- </a>
- </>
- );
- }
-
- return (
- <>
- <ConferencingProviderIcon provider={conferencing.provider} size={16} />
- <span>{conferencingProviderLabels[conferencing.provider]}</span>
+ <a
+ href={joinUri}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="inline-flex items-center gap-0.5 font-medium text-link"
+ >
+ <Trans i18nKey="joinMeeting" defaults="Join" />
+ <ArrowUpRightIcon aria-hidden="true" className="text-current!" />
+ <span className="sr-only">
+ <Trans i18nKey="opensInNewTab" defaults="(opens in new tab)" />
+ </span>
+ </a>
+ </>
+ ) : null}
</>
);
}
diff --git a/apps/web/src/features/poll/components/event-card.tsx b/apps/web/src/features/poll/components/event-card.tsx
index e3c146ec7..f52aaaf71 100644
--- a/apps/web/src/features/poll/components/event-card.tsx
+++ b/apps/web/src/features/poll/components/event-card.tsx
@@ -102,7 +102,10 @@ export function EventCard() {
) : null}
{poll.conferencing ? (
<EventMetaItem>
- <PollConferencingSummary conferencing={poll.conferencing} />
+ <PollConferencingSummary
+ conferencing={poll.conferencing}
+ meetingUri={poll.event?.conferencingUri}
+ />
</EventMetaItem>
) : null}
</EventMetaList>
diff --git a/apps/web/src/features/poll/data.ts b/apps/web/src/features/poll/data.ts
index 845903dd7..1ce63b7e7 100644
--- a/apps/web/src/features/poll/data.ts
+++ b/apps/web/src/features/poll/data.ts
@@ -3,7 +3,11 @@ import "server-only";
import type { PollStatus, Prisma, VoteType } from "@rallly/database";
import { prisma } from "@rallly/database";
import { shortUrl } from "@rallly/utils/absolute-url";
-import { parsePollConferencing } from "@/features/conferencing/data";
+import {
+ parseConferencing,
+ parsePollConferencing,
+} from "@/features/conferencing/data";
+import { getConferencingUri } from "@/features/conferencing/utils";
import { getInstancePolicy } from "@/features/instance-policy/data";
import { VOTE_TYPES } from "@/features/poll/constants";
import type {
@@ -746,6 +750,7 @@ export async function getPollDetails({
end: true,
allDay: true,
status: true,
+ conferencing: true,
},
},
},
@@ -770,6 +775,15 @@ export async function getPollDetails({
...pollFields
} = poll;
+ // The minted meeting is already public through the event's calendar
+ // links, which this page offers to anyone holding the poll link.
+ const eventConferencing =
+ scheduledEvent && scheduledEvent.status !== "canceled"
+ ? parseConferencing(scheduledEvent.conferencing, {
+ scheduledEventId: scheduledEvent.id,
+ })
+ : null;
+
return {
...pollFields,
conferencing: parsePollConferencing(conferencing, { pollId: poll.id }),
@@ -799,6 +813,9 @@ export async function getPollDetails({
60_000,
),
status: scheduledEvent.status,
+ conferencingUri: eventConferencing
+ ? getConferencingUri(eventConferencing)
+ : null,
}
: null,
inviteLink: shortUrl(`/invite/${poll.id}`),
diff --git a/apps/web/src/features/poll/types.ts b/apps/web/src/features/poll/types.ts
index d4f3d1952..83a6dc59b 100644
--- a/apps/web/src/features/poll/types.ts
+++ b/apps/web/src/features/poll/types.ts
@@ -33,7 +33,13 @@ export type PollDetails = {
hideAttribution: boolean;
primaryColor: string | null;
} | null;
- event: { id: string; start: Date; duration: number; status: string } | null;
+ event: {
+ id: string;
+ start: Date;
+ duration: number;
+ status: string;
+ conferencingUri: string | null;
+ } | null;
inviteLink: string;
};