diff --git a/apps/web/public/locales/en/app.json b/apps/web/public/locales/en/app.json index ae2096df7..8a9f58546 100644 --- a/apps/web/public/locales/en/app.json +++ b/apps/web/public/locales/en/app.json @@ -278,7 +278,8 @@ "1month": "1 month", "subscribe": "Subscribe", "cancelAnytime": "Cancel anytime from your billing page.", - "copiedToClipboard": "Copied to clipboard", "viewAll": "View All", - "pending": "Pending" + "pending": "Pending", + "copyLink": "Copy link", + "viewResults": "View results" } diff --git a/apps/web/src/app/[locale]/(admin)/polls/user-polls.tsx b/apps/web/src/app/[locale]/(admin)/polls/user-polls.tsx index 41781cad3..a56a90d56 100644 --- a/apps/web/src/app/[locale]/(admin)/polls/user-polls.tsx +++ b/apps/web/src/app/[locale]/(admin)/polls/user-polls.tsx @@ -1,7 +1,6 @@ "use client"; import { PollStatus } from "@rallly/database"; import { RadioCards, RadioCardsItem } from "@rallly/ui/radio-pills"; -import { getCoreRowModel, useReactTable } from "@tanstack/react-table"; import { CalendarPlusIcon } from "lucide-react"; import { useSearchParams } from "next/navigation"; import { z } from "zod"; @@ -29,6 +28,7 @@ function FilteredPolls({ status }: { status: PollStatus }) { limit: 30, }, { + suspense: true, getNextPageParam: (lastPage) => lastPage.nextCursor, keepPreviousData: true, }, @@ -59,7 +59,7 @@ function FilteredPolls({ status }: { status: PollStatus }) {
    {data.pages.map((page, i) => (
  1. -
    +
    {page.polls.map((poll) => ( void; }) { const { data: countByStatus, isFetching } = - trpc.polls.getCountByStatus.useQuery(); + trpc.polls.getCountByStatus.useQuery(undefined, { + suspense: true, + }); if (!countByStatus) { return null; diff --git a/apps/web/src/components/grid-card.tsx b/apps/web/src/components/grid-card.tsx index b06e19576..050006a5f 100644 --- a/apps/web/src/components/grid-card.tsx +++ b/apps/web/src/components/grid-card.tsx @@ -1,5 +1,5 @@ export function GridCardFooter({ children }: React.PropsWithChildren) { - return
    {children}
    ; + return
    {children}
    ; } export function GridCardHeader({ children }: React.PropsWithChildren) { @@ -8,6 +8,6 @@ export function GridCardHeader({ children }: React.PropsWithChildren) { export const GridCard = ({ children }: { children: React.ReactNode }) => { return ( -
    {children}
    +
    {children}
    ); }; diff --git a/apps/web/src/components/group-poll-card.tsx b/apps/web/src/components/group-poll-card.tsx index 015807443..a610e5d42 100644 --- a/apps/web/src/components/group-poll-card.tsx +++ b/apps/web/src/components/group-poll-card.tsx @@ -2,16 +2,17 @@ import { PollStatus } from "@rallly/database"; import { Button } from "@rallly/ui/button"; -import { useToast } from "@rallly/ui/hooks/use-toast"; import { Icon } from "@rallly/ui/icon"; +import { Tooltip, TooltipContent, TooltipTrigger } from "@rallly/ui/tooltip"; import { BarChart2Icon, CalendarIcon, + CheckIcon, Link2Icon, User2Icon, } from "lucide-react"; import Link from "next/link"; -import { useTranslation } from "react-i18next"; +import React from "react"; import { useCopyToClipboard } from "react-use"; import { @@ -26,6 +27,45 @@ import { Trans } from "@/components/trans"; import { useLocalizeTime } from "@/utils/dayjs"; import { getRange } from "@/utils/get-range"; +function CopyLinkButton({ link, ...forwardProps }: { link: string }) { + const [, copy] = useCopyToClipboard(); + const [isCopied, setIsCopied] = React.useState(false); + + return ( + + + + + + {isCopied ? ( +

    + + +

    + ) : ( + + )} +
    +
    + ); +} + export function GroupPollCard({ status, pollId, @@ -45,10 +85,6 @@ export function GroupPollCard({ }) { const localizeTime = useLocalizeTime(); - const { t } = useTranslation("app"); - const [, copy] = useCopyToClipboard(); - const { toast } = useToast(); - return ( @@ -56,7 +92,10 @@ export function GroupPollCard({

    - + {title}

    @@ -82,29 +121,23 @@ export function GroupPollCard({ - - +
    + + + + + + + + + +
    ); diff --git a/apps/web/src/components/heading.tsx b/apps/web/src/components/heading.tsx index b4c4b6bbb..0e51d498d 100644 --- a/apps/web/src/components/heading.tsx +++ b/apps/web/src/components/heading.tsx @@ -9,7 +9,7 @@ export function Heading({ return (

    ) { return ( -

    {children}

    +

    + {children} +

    ); }