mirror of
https://github.com/lukevella/rallly.git
synced 2025-04-28 17:56:37 +02:00
💄 Update create page
This commit is contained in:
parent
223cc29645
commit
27ed51c526
5 changed files with 56 additions and 16 deletions
|
@ -236,7 +236,6 @@
|
||||||
"12months": "12 months",
|
"12months": "12 months",
|
||||||
"savePercentage": "Save {percentage}%",
|
"savePercentage": "Save {percentage}%",
|
||||||
"1month": "1 month",
|
"1month": "1 month",
|
||||||
"subscribe": "Subscribe",
|
|
||||||
"cancelAnytime": "Cancel anytime from your <a>billing page</a>.",
|
"cancelAnytime": "Cancel anytime from your <a>billing page</a>.",
|
||||||
"unsubscribeToastTitle": "You have disabled notifications",
|
"unsubscribeToastTitle": "You have disabled notifications",
|
||||||
"unsubscribeToastDescription": "You will no longer receive notifications for this poll",
|
"unsubscribeToastDescription": "You will no longer receive notifications for this poll",
|
||||||
|
@ -303,5 +302,6 @@
|
||||||
"addPaymentMethod": "Add Payment Method",
|
"addPaymentMethod": "Add Payment Method",
|
||||||
"needToMakeChanges": "Need to make changes?",
|
"needToMakeChanges": "Need to make changes?",
|
||||||
"billingPortalDescription": "Visit the billing portal to manage your subscription, update payment methods, or view billing history.",
|
"billingPortalDescription": "Visit the billing portal to manage your subscription, update payment methods, or view billing history.",
|
||||||
"priceFree": "Free"
|
"priceFree": "Free",
|
||||||
|
"signUp": "Sign Up"
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,12 @@
|
||||||
|
|
||||||
import { Button } from "@rallly/ui/button";
|
import { Button } from "@rallly/ui/button";
|
||||||
import { Icon } from "@rallly/ui/icon";
|
import { Icon } from "@rallly/ui/icon";
|
||||||
import { MenuIcon, XIcon } from "lucide-react";
|
import { ArrowLeftIcon, MenuIcon } from "lucide-react";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
|
import { Trans } from "@/components/trans";
|
||||||
|
|
||||||
export function BackButton() {
|
export function BackButton() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
return (
|
return (
|
||||||
|
@ -15,7 +17,10 @@ export function BackButton() {
|
||||||
router.back();
|
router.back();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<XIcon className="text-muted-foreground size-4" />
|
<ArrowLeftIcon className="text-muted-foreground size-4" />
|
||||||
|
<span className="hidden sm:block">
|
||||||
|
<Trans i18nKey="back" defaults="Back" />
|
||||||
|
</span>
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { Button } from "@rallly/ui/button";
|
||||||
|
import Link from "next/link";
|
||||||
import { Trans } from "react-i18next/TransWithoutContext";
|
import { Trans } from "react-i18next/TransWithoutContext";
|
||||||
|
|
||||||
import { GroupPollIcon } from "@/app/[locale]/(admin)/app-card";
|
import { GroupPollIcon } from "@/app/[locale]/(admin)/app-card";
|
||||||
|
@ -6,14 +8,21 @@ import type { Params } from "@/app/[locale]/types";
|
||||||
import { CreatePoll } from "@/components/create-poll";
|
import { CreatePoll } from "@/components/create-poll";
|
||||||
import { UserDropdown } from "@/components/user-dropdown";
|
import { UserDropdown } from "@/components/user-dropdown";
|
||||||
import { getTranslation } from "@/i18n/server";
|
import { getTranslation } from "@/i18n/server";
|
||||||
|
import { getLoggedIn } from "@/next-auth";
|
||||||
|
|
||||||
export default async function Page({ params }: { params: Params }) {
|
export default async function Page({ params }: { params: Params }) {
|
||||||
const { t } = await getTranslation(params.locale);
|
const { t } = await getTranslation(params.locale);
|
||||||
|
const isLoggedIn = await getLoggedIn();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className="sticky top-0 z-20 flex items-center justify-between border-b bg-gray-100/90 p-3 backdrop-blur-md sm:grid-cols-3">
|
<div className="sticky top-0 z-20 border-b bg-gray-100/90 p-3 backdrop-blur-md sm:grid-cols-3">
|
||||||
<div className="flex items-center justify-center gap-x-4">
|
<div className="mx-auto flex max-w-4xl items-center justify-between gap-x-2 sm:px-6">
|
||||||
|
<div className="flex items-center gap-x-4 sm:flex-1">
|
||||||
<BackButton />
|
<BackButton />
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-1 sm:justify-center">
|
||||||
|
<div className="flex items-center gap-x-2">
|
||||||
<GroupPollIcon size="xs" />
|
<GroupPollIcon size="xs" />
|
||||||
<div className="flex items-baseline gap-x-8">
|
<div className="flex items-baseline gap-x-8">
|
||||||
<h1 className="text-sm font-semibold">
|
<h1 className="text-sm font-semibold">
|
||||||
|
@ -21,8 +30,29 @@ export default async function Page({ params }: { params: Params }) {
|
||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-end">
|
</div>
|
||||||
|
<div className="flex flex-1 justify-end">
|
||||||
|
{isLoggedIn ? (
|
||||||
<UserDropdown />
|
<UserDropdown />
|
||||||
|
) : (
|
||||||
|
<div className="flex items-center gap-x-2">
|
||||||
|
<Button variant="ghost" asChild>
|
||||||
|
<Link
|
||||||
|
href={`/login?redirectTo=${encodeURIComponent("/new")}`}
|
||||||
|
>
|
||||||
|
<Trans i18nKey="login" />
|
||||||
|
</Link>
|
||||||
|
</Button>
|
||||||
|
<Button variant="primary" asChild>
|
||||||
|
<Link
|
||||||
|
href={`/register?redirectTo=${encodeURIComponent("/new")}`}
|
||||||
|
>
|
||||||
|
<Trans i18nKey="signUp" defaults="Sign up" />
|
||||||
|
</Link>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="mx-auto max-w-4xl p-3 sm:px-6 sm:py-5">
|
<div className="mx-auto max-w-4xl p-3 sm:px-6 sm:py-5">
|
||||||
|
|
|
@ -221,4 +221,9 @@ export const getUserId = async () => {
|
||||||
return session?.user?.email ? session.user.id : null;
|
return session?.user?.email ? session.user.id : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getLoggedIn = async () => {
|
||||||
|
const session = await auth();
|
||||||
|
return !!session?.user?.email;
|
||||||
|
};
|
||||||
|
|
||||||
export { auth, handlers, requireUser, signIn, signOut };
|
export { auth, handlers, requireUser, signIn, signOut };
|
||||||
|
|
|
@ -16,7 +16,7 @@ const buttonVariants = cva(
|
||||||
variants: {
|
variants: {
|
||||||
variant: {
|
variant: {
|
||||||
primary:
|
primary:
|
||||||
"focus:ring-offset-1 border-primary bg-primary hover:bg-primary-500 disabled:bg-gray-400 disabled:border-transparent text-primary-foreground shadow-sm",
|
"focus:ring-offset-1 border-primary bg-primary hover:bg-primary-500 disabled:bg-gray-400 disabled:border-transparent text-white shadow-sm",
|
||||||
destructive:
|
destructive:
|
||||||
"focus:ring-offset-1 bg-destructive shadow-sm text-destructive-foreground active:bg-destructive border-destructive hover:bg-destructive/90",
|
"focus:ring-offset-1 bg-destructive shadow-sm text-destructive-foreground active:bg-destructive border-destructive hover:bg-destructive/90",
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Add table
Reference in a new issue