Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
💄 Update poll page (#1672)
Luke Vellacf90e7a6df38
diff --git a/apps/web/src/app/[locale]/(space)/polls/page.tsx b/apps/web/src/app/[locale]/(space)/polls/page.tsxindex e751b69b9..70846990a 100644--- a/apps/web/src/app/[locale]/(space)/polls/page.tsx+++ b/apps/web/src/app/[locale]/(space)/polls/page.tsx@@ -1,6 +1,6 @@import type { PollStatus } from "@rallly/database";import { Button } from "@rallly/ui/button";-import { shortUrl } from "@rallly/utils/absolute-url";+import { absoluteUrl, shortUrl } from "@rallly/utils/absolute-url";import { InboxIcon } from "lucide-react";import Link from "next/link";import { z } from "zod";@@ -186,6 +186,7 @@ export default async function Page({title={poll.title}status={poll.status}participants={poll.participants}+ pollLink={absoluteUrl(`/poll/${poll.id}`)}inviteLink={shortUrl(`/invite/${poll.id}`)}/>))}diff --git a/apps/web/src/app/[locale]/invite/[urlId]/invite-page.tsx b/apps/web/src/app/[locale]/invite/[urlId]/invite-page.tsxindex 4b4f305fe..d059d4d7c 100644--- a/apps/web/src/app/[locale]/invite/[urlId]/invite-page.tsx+++ b/apps/web/src/app/[locale]/invite/[urlId]/invite-page.tsx@@ -54,18 +54,21 @@ export function InvitePage() {const poll = usePoll();return (- <div className="mx-auto max-w-4xl space-y-3 p-3 lg:space-y-4 lg:px-4 lg:py-8">- {/* Track poll views */}+ <div><PollViewTracker pollId={poll.id} /><PollHeader />- <GoToApp />- <EventCard />- <ScheduledEvent />- <VotingForm>- <ResponsiveResults />- </VotingForm>- <Discussion />- <PollFooter />+ <div className="p-3">+ <div className="mx-auto w-full max-w-4xl space-y-4">+ <GoToApp />+ <EventCard />+ <ScheduledEvent />+ <VotingForm>+ <ResponsiveResults />+ </VotingForm>+ <Discussion />+ <PollFooter />+ </div>+ </div></div>);}diff --git a/apps/web/src/app/[locale]/poll/[urlId]/admin-page.tsx b/apps/web/src/app/[locale]/poll/[urlId]/admin-page.tsxindex 5395d6f2a..ab4a51c07 100644--- a/apps/web/src/app/[locale]/poll/[urlId]/admin-page.tsx+++ b/apps/web/src/app/[locale]/poll/[urlId]/admin-page.tsx@@ -2,7 +2,6 @@import Discussion from "@/components/discussion";import { EventCard } from "@/components/event-card";import { PollFooter } from "@/components/poll/poll-footer";-import { PollHeader } from "@/components/poll/poll-header";import { PollViewTracker } from "@/components/poll/poll-view-tracker";import { ResponsiveResults } from "@/components/poll/responsive-results";import { ScheduledEvent } from "@/components/poll/scheduled-event";@@ -21,7 +20,6 @@ export function AdminPage() {{/* Track poll views */}<PollViewTracker pollId={poll.id} /><UnsubscribeAlert />- <PollHeader /><GuestPollAlert /><EventCard /><ScheduledEvent />diff --git a/apps/web/src/components/layouts/poll-layout.tsx b/apps/web/src/components/layouts/poll-layout.tsxindex a179ec8d7..b3201f37f 100644--- a/apps/web/src/components/layouts/poll-layout.tsx+++ b/apps/web/src/components/layouts/poll-layout.tsx@@ -7,14 +7,12 @@ import {LogInIcon,LogOutIcon,ShieldCloseIcon,- XIcon,} from "lucide-react";import Link from "next/link";import { useParams, usePathname } from "next/navigation";import React from "react";import { LogoutButton } from "@/app/components/logout-button";-import { PollPageIcon } from "@/app/components/page-icons";import { InviteDialog } from "@/components/invite-dialog";import { LoginLink } from "@/components/login-link";import {@@ -46,37 +44,41 @@ const Layout = ({ children }: React.PropsWithChildren) => {const pollLink = `/poll/${poll.id}`;const pathname = usePathname();return (- <div className="bg-gray-100">- <div className="sticky top-0 z-30 flex flex-col justify-between gap-x-4 gap-y-2.5 border-b bg-gray-100 p-3 sm:flex-row lg:items-center lg:px-5">- <div className="flex min-w-0 items-center gap-x-2.5">- {pathname === pollLink ? (- <Button variant="ghost" asChild>- <Link href="/polls">- <Icon>- <XIcon />- </Icon>- </Link>- </Button>- ) : (- <Button variant="ghost" asChild>- <Link href={pollLink}>- <Icon>- <ArrowLeftIcon />- </Icon>- </Link>- </Button>- )}+ <div>+ <div className="sticky top-0 z-30 border-b bg-gray-100/90 p-3 backdrop-blur-md sm:flex-row">+ <div className="mx-auto flex max-w-4xl justify-between">+ <div className="flex min-w-0 items-center gap-x-2.5">+ {pathname === pollLink ? (+ <Button variant="ghost" asChild>+ <Link href="/polls">+ <Icon>+ <ArrowLeftIcon />+ </Icon>+ <span>+ <Trans i18nKey="back" defaults="Back" />+ </span>+ </Link>+ </Button>+ ) : (+ <Button variant="ghost" asChild>+ <Link href={pollLink}>+ <Icon>+ <ArrowLeftIcon />+ </Icon>+ <span>+ <Trans i18nKey="back" defaults="Back" />+ </span>+ </Link>+ </Button>+ )}+ </div><div>- <PollPageIcon size="sm" />+ <AdminControls /></div>- <h1 className="truncate text-sm font-semibold">{poll.title}</h1>- </div>- <div>- <AdminControls /></div></div>- <div className="mx-auto max-w-4xl space-y-3 p-3 lg:space-y-4 lg:px-4 lg:py-8">- {children}+ <div className="p-3">+ <div className="mx-auto max-w-4xl space-y-3">{children}</div></div></div>);diff --git a/apps/web/src/components/poll/manage-poll.tsx b/apps/web/src/components/poll/manage-poll.tsxindex 0874633b3..ed15bd4d7 100644--- a/apps/web/src/components/poll/manage-poll.tsx+++ b/apps/web/src/components/poll/manage-poll.tsx@@ -151,11 +151,13 @@ const ManagePoll: React.FunctionComponent<{<><DropdownMenu modal={false}><DropdownMenuTrigger asChild={true}>- <Button disabled={disabled}>+ <Button variant="ghost" disabled={disabled}><Icon><SettingsIcon /></Icon>- <Trans i18nKey="manage" />+ <span className="hidden sm:block">+ <Trans i18nKey="manage" />+ </span><Icon><ChevronDownIcon /></Icon>diff --git a/apps/web/src/components/poll/notifications-toggle.tsx b/apps/web/src/components/poll/notifications-toggle.tsxindex 88aa7b3cb..772807e25 100644--- a/apps/web/src/components/poll/notifications-toggle.tsx+++ b/apps/web/src/components/poll/notifications-toggle.tsx@@ -83,7 +83,7 @@ const NotificationsToggle: React.FunctionComponent = () => {<Buttondata-testid="notifications-toggle"disabled={user.isGuest}- className="flex items-center gap-2 px-2.5"+ variant="ghost"onClick={async () => {if (user.isGuest) {signIn();diff --git a/apps/web/src/components/poll/poll-footer.tsx b/apps/web/src/components/poll/poll-footer.tsxindex a05f672ff..f3cb7c76b 100644--- a/apps/web/src/components/poll/poll-footer.tsx+++ b/apps/web/src/components/poll/poll-footer.tsx@@ -4,7 +4,7 @@ import { Trans } from "@/components/trans";export function PollFooter() {return (- <div className="py-4 text-center text-sm text-gray-500">+ <div className="pb-12 pt-4 text-center text-sm text-gray-500"><Transdefaults="Powered by <a>{name}</a>"i18nKey="poweredByRallly"diff --git a/apps/web/src/components/poll/poll-header.tsx b/apps/web/src/components/poll/poll-header.tsxindex a9090a04e..8886510ae 100644--- a/apps/web/src/components/poll/poll-header.tsx+++ b/apps/web/src/components/poll/poll-header.tsx@@ -1,14 +1,46 @@-import { LogoLink } from "@/app/components/logo-link";+import { Button } from "@rallly/ui/button";+import Image from "next/image";+import Link from "next/link";+import { UserDropdown } from "@/components/user-dropdown";+import { useUser } from "../user-provider";+export function PollHeader() {+ const { user } = useUser();return (- <div className="flex items-center justify-between">- <div className="flex items-center gap-x-2.5">- <LogoLink />- </div>- <div className="flex items-center gap-x-2.5">- <UserDropdown />+ <div className="sticky top-0 z-30 border-b bg-gray-100/90 p-3 backdrop-blur-md">+ <div className="mx-auto flex max-w-4xl items-center justify-between">+ <div className="flex items-center gap-x-2.5">+ <Link+ className="transition-transform active:translate-y-1"+ href="https://rallly.co"+ >+ <Image+ src="/images/logo-mark.svg"+ alt="Rallly"+ width={32}+ height={32}+ priority={true}+ className="shrink-0"+ />+ <span className="sr-only">Rallly</span>+ </Link>+ </div>+ <div className="flex items-center gap-x-2.5">+ {user.email ? (+ <UserDropdown />+ ) : (+ <>+ <Button variant="ghost" asChild>+ <Link href="/login">Login</Link>+ </Button>+ <Button variant="primary" asChild>+ <Link href="/register">Sign Up</Link>+ </Button>+ </>+ )}+ </div></div></div>);diff --git a/apps/web/src/features/poll/components/poll-list.tsx b/apps/web/src/features/poll/components/poll-list.tsxindex d66db0f5f..6a0b1d543 100644--- a/apps/web/src/features/poll/components/poll-list.tsx+++ b/apps/web/src/features/poll/components/poll-list.tsx@@ -14,11 +14,13 @@ export function PollListItem({status,participants,inviteLink,+ pollLink,}: {title: string;status: PollStatus;participants: { id: string; name: string; image?: string }[];inviteLink: string;+ pollLink: string;}) {return (<StackedListItem>@@ -26,7 +28,7 @@ export function PollListItem({<PollStatusIcon status={status} showTooltip={false} /><LinkclassName="focus:ring-ring min-w-0 text-sm font-medium hover:underline focus-visible:ring-2"- href={inviteLink}+ href={pollLink}><span className="absolute inset-0" /><span className="block truncate">{title}</span>