Skip to content
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

🎨 Update admin layout and pages #976

Merged
merged 75 commits into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from 69 commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
4d6a12e
Better rendering
lukevella Dec 5, 2023
e69fb3f
Checkpoint with new layout
lukevella Dec 7, 2023
a5be1e3
More updates
lukevella Dec 7, 2023
45f400e
Checkpoint
lukevella Dec 8, 2023
8d8be44
Checkpoint
lukevella Dec 8, 2023
2bf8b2b
Checkpoint
lukevella Dec 8, 2023
045c5d5
Mobile update
lukevella Dec 8, 2023
e73232e
More updates
lukevella Dec 9, 2023
5c1aaaf
Save
lukevella Dec 10, 2023
9b7fc0e
Update toast styles
lukevella Dec 10, 2023
9f7917c
Unused imports
lukevella Dec 10, 2023
2684849
Use session cookie to auto copy invite link
lukevella Dec 10, 2023
2d37e00
Add finalized date to polls page
lukevella Dec 11, 2023
4c4d568
Update
lukevella Dec 12, 2023
24c6075
Paginated table
lukevella Dec 12, 2023
c3c0423
Update Icon colors
lukevella Dec 12, 2023
012dc08
Spacing
lukevella Dec 12, 2023
bf4f47a
Sidebar nav
lukevella Dec 12, 2023
62825f0
Update
lukevella Dec 15, 2023
b367fb7
Update button styles
lukevella Dec 15, 2023
0710ed0
More style updates
lukevella Dec 15, 2023
18d20f4
Update profile layout
lukevella Dec 15, 2023
ce366b6
Update tooltip
lukevella Dec 19, 2023
0b85dcd
Clean up
lukevella Dec 19, 2023
db8ddab
Fix page count
lukevella Jan 3, 2024
92e9843
No participants tooltip
lukevella Jan 3, 2024
64f2c6b
Static menu page
lukevella Jan 8, 2024
280a7ec
Fix linting
lukevella Jan 8, 2024
8ccf99e
Revert icon color change
lukevella Jan 8, 2024
5da6705
Bring back metadata for new page
lukevella Jan 8, 2024
1c43c72
Styling fixes
lukevella Jan 8, 2024
5103be3
Update logout flow
lukevella Jan 8, 2024
bcea879
Logout button
lukevella Jan 9, 2024
23c3c79
Destruxtive button
lukevella Jan 9, 2024
369f217
Remove settings header
lukevella Jan 10, 2024
46c5994
Sticky page header
lukevella Jan 10, 2024
e9602e4
Simplify pay wall
lukevella Jan 10, 2024
57d304a
Settings page styles
lukevella Jan 10, 2024
54127c2
Guest user profile page
lukevella Jan 10, 2024
2974c42
Revert page layout spacing
lukevella Jan 10, 2024
63fd278
Update invite page header spacing
lukevella Jan 10, 2024
f679631
Remove button icon styling
lukevella Jan 10, 2024
7df6d21
Update event card title styling
lukevella Jan 10, 2024
b74665a
Revert invite dialog
lukevella Jan 10, 2024
a443a47
Clean up
lukevella Jan 10, 2024
f98d08c
Table styles
lukevella Jan 11, 2024
c5d8d7b
Event card styles
lukevella Jan 11, 2024
f0285ca
Update polls list to show end time
lukevella Jan 11, 2024
0541d30
Fix menu styling
lukevella Jan 11, 2024
1b99184
Update
lukevella Jan 11, 2024
1affb36
Fix change button
lukevella Jan 11, 2024
633faa3
Update
lukevella Jan 11, 2024
e33aeb4
Update event card
lukevella Jan 11, 2024
36600ac
Clean up
lukevella Jan 11, 2024
6d186bf
Update
lukevella Jan 11, 2024
a6323c3
Update
lukevella Jan 11, 2024
25fce1b
Update
lukevella Jan 12, 2024
f51bf4a
Move new
lukevella Jan 12, 2024
117d878
Update
lukevella Jan 12, 2024
b00fbb1
Hide pro badge if already pro
lukevella Jan 12, 2024
3cecf74
Mobile settings menu
lukevella Jan 12, 2024
f6112a5
Update
lukevella Jan 12, 2024
3bee27f
Fix linting
lukevella Jan 12, 2024
2081b85
Delete outdated test
lukevella Jan 12, 2024
ea7ba5d
Fix tests
lukevella Jan 12, 2024
d5327d7
Bump next
lukevella Jan 12, 2024
09f4b16
Fix next config
lukevella Jan 12, 2024
31bc2e9
Small fixes
lukevella Jan 12, 2024
19f40c3
More fixes
lukevella Jan 12, 2024
1c1703a
Fix infinite loop
lukevella Jan 13, 2024
c25af9f
Update link styling
lukevella Jan 13, 2024
bcf0541
Fix infinite loop for real this time
lukevella Jan 13, 2024
cfeacb4
Delete old layout
lukevella Jan 13, 2024
62eecf3
New poll header
lukevella Jan 13, 2024
aaa6b89
Change home icon
lukevella Jan 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"editor.codeActionsOnSave": {
"source.fixAll": true
"source.fixAll": "explicit"
},
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.preferences.importModuleSpecifier": "non-relative",
Expand Down
14 changes: 7 additions & 7 deletions apps/web/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,12 @@ const nextConfig = {
},
];
},
sentry: {
hideSourceMaps: false,
},
};

const sentryWebpackPluginOptions = {
// Additional config options for the Sentry Webpack plugin. Keep in mind that
org: "stack-snap",
project: "rallly",
// Additional config ocptions for the Sentry Webpack plugin. Keep in mind that
// the following options are set automatically, and overriding them is not
// recommended:
// release, url, org, project, authToken, configFile, stripPrefix,
Expand All @@ -70,8 +69,9 @@ const sentryWebpackPluginOptions = {
// https://github.com/getsentry/sentry-webpack-plugin#options.
};

const withBundleAnalyzerConfig = withBundleAnalyzer(nextConfig);
// Make sure adding Sentry options is the last code to run before exporting, to
// ensure that your source maps include changes from all other Webpack plugins
module.exports = withSentryConfig(
withBundleAnalyzer(nextConfig, sentryWebpackPluginOptions),
);
module.exports = process.env.SENTRY_AUTH_TOKEN
? withSentryConfig(withBundleAnalyzerConfig, sentryWebpackPluginOptions)
: withBundleAnalyzerConfig;
1 change: 1 addition & 0 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"iron-session": "^6.3.1",
"js-cookie": "^3.0.1",
"lodash": "^4.17.21",
"lucide-react": "^0.294.0",
"micro": "^10.0.1",
"nanoid": "^4.0.0",
"next-auth": "^4.24.5",
Expand Down
37 changes: 23 additions & 14 deletions apps/web/public/locales/en/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,6 @@
"dates": "Dates",
"menu": "Menu",
"useLocaleDefaults": "Use locale defaults",
"inviteParticipantsDescription": "Copy and share this invite link to start gathering responses from your participants.",
"inviteLink": "Invite Link",
"inviteParticipantLinkInfo": "Anyone with this link will be able to vote on your poll.",
"support": "Support",
"billing": "Billing",
"guestPollAlertDescription": "<0>Create an account</0> or <1>login</1> to claim this poll.",
Expand All @@ -135,7 +132,6 @@
"permissionDenied": "Unauthorized",
"permissionDeniedDescription": "If you are the poll creator, please login to access your poll",
"loginDifferent": "Switch user",
"share": "Share",
"timeShownIn": "Times shown in {timeZone}",
"editDetailsDescription": "Change the details of your event.",
"finalizeDescription": "Select a final date for your event.",
Expand Down Expand Up @@ -210,14 +206,7 @@
"earlyAccess": "Get early access to new features",
"earlyAdopterDescription": "As an early adopter, you'll lock in your subscription rate and won't be affected by future price increases.",
"upgradeNowSaveLater": "Upgrade now, save later",
"savePercent": "Save {percent}%",
"priceIncreaseSoon": "Price increase soon.",
"lockPrice": "Upgrade today to keep this price forever.",
"features": "Get access to all current and future Pro features!",
"noAds": "No ads",
"supportProject": "Support this project",
"pricing": "Pricing",
"pleaseUpgrade": "Please upgrade to Pro to use this feature",
"pollSettingsDescription": "Customize the behaviour of your poll",
"requireParticipantEmailLabel": "Make email address required for participants",
"hideParticipantsLabel": "Hide participant list from other participants",
Expand All @@ -226,8 +215,28 @@
"authErrorDescription": "There was an error logging you in. Please try again.",
"authErrorCta": "Go to login page",
"continueAs": "Continue as",
"finalizeFeature": "Finalize",
"duplicateFeature": "Duplicate",
"pageMovedDescription": "Redirecting to <a>{newUrl}</a>",
"notRegistered": "Don't have an account? <a>Register</a>"
"notRegistered": "Don't have an account? <a>Register</a>",
"comingSoon": "Coming Soon",
"integrations": "Integrations",
"contacts": "Contacts",
"unlockFeatures": "Unlock all Pro features.",
"back": "Back",
"pollStatusAll": "All",
"pollStatusLive": "Live",
"pollStatusFinalized": "Finalized",
"pending": "Pending",
"xMore": "{count} more",
"share": "Share",
"pageXOfY": "Page {currentPage} of {pageCount}",
"noParticipants": "No participants",
"userId": "User ID",
"aboutGuest": "Guest User",
"aboutGuestDescription": "Profile settings are not available for guest users. <0>Sign in</0> to your existing account or <1>create a new account</1> to customize your profile.",
"logoutDescription": "Sign out of your existing session",
"events": "Events",
"registrations": "Registrations",
"inviteParticipantsDescription": "Copy and share the invite link to start gathering responses from your participants.",
"inviteLink": "Invite Link",
"inviteParticipantLinkInfo": "Anyone with this link will be able to vote on your poll."
}
59 changes: 54 additions & 5 deletions apps/web/src/app/[locale]/(admin)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
"use client";
import { cn } from "@rallly/ui";
import { Button } from "@rallly/ui/button";
import { MenuIcon } from "lucide-react";
import Link from "next/link";
import { signIn, useSession } from "next-auth/react";
import React from "react";

import { StandardLayout } from "@/components/layouts/standard-layout";
import { Sidebar } from "@/app/[locale]/(admin)/sidebar";
import { LogoLink } from "@/app/components/logo-link";
import { CurrentUserAvatar } from "@/components/user";
import { isSelfHosted } from "@/utils/constants";

const Auth = ({ children }: { children: React.ReactNode }) => {
Expand All @@ -22,13 +27,57 @@ const Auth = ({ children }: { children: React.ReactNode }) => {
return null;
};

export default function Layout({ children }: { children: React.ReactNode }) {
function MobileNavigation() {
return (
<div className="lg:hidden shadow-sm bg-gray-100 border-b flex items-center justify-between px-4 py-3">
<LogoLink />
<div className="flex gap-x-2.5 justify-end">
<Link
href="/settings/profile"
className="inline-flex items-center w-7 h-9"
>
<CurrentUserAvatar size="sm" />
</Link>
<Button asChild variant="ghost">
<Link href="/menu">
<MenuIcon className="h-4 w-4 text-muted-foreground" />
</Link>
</Button>
</div>
</div>
);
}

export default async function Layout({
children,
}: {
children: React.ReactNode;
}) {
function SidebarLayout() {
return (
<div className="lg:flex h-full bg-gray-50">
<MobileNavigation />
<div
className={cn(
"hidden lg:flex lg:w-72 bg-gray-100 shrink-0 flex-col gap-y-5 overflow-y-auto border-r lg:px-6 lg:py-4 px-5 py-4",
)}
>
<div>
<LogoLink />
</div>
<Sidebar />
</div>
<div className={cn("grow overflow-auto bg-gray-50")}>{children}</div>
</div>
);
}

if (isSelfHosted) {
return (
<Auth>
<StandardLayout>{children}</StandardLayout>
<SidebarLayout />
</Auth>
);
}
return <StandardLayout>{children}</StandardLayout>;
return <SidebarLayout />;
}
42 changes: 42 additions & 0 deletions apps/web/src/app/[locale]/(admin)/menu-item.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"use client";

import { cn } from "@rallly/ui";
import { Link } from "lucide-react";
import { usePathname } from "next/navigation";

import { IconComponent } from "@/types";

export function MenuItem({
href,
children,
icon: Icon,
}: {
href: string;
icon: IconComponent;
children: React.ReactNode;
}) {
const pathname = usePathname();
const isCurrent = pathname === href;
return (
<Link
href={href}
className={cn(
isCurrent
? "bg-gray-200 text-indigo-600"
: "text-gray-700 hover:text-primary",
"group flex items-center gap-x-3 rounded-md py-2 px-3 text-sm leading-6 font-semibold",
)}
>
<Icon
className={cn(
isCurrent
? "text-indigo-600"
: "text-gray-400 group-hover:text-indigo-600",
"h-5 w-5 shrink-0",
)}
aria-hidden="true"
/>
{children}
</Link>
);
}
3 changes: 3 additions & 0 deletions apps/web/src/app/[locale]/(admin)/new/loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function Loading() {
return null;
}
9 changes: 8 additions & 1 deletion apps/web/src/app/[locale]/(admin)/new/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import { PageContainer, PageContent } from "@/app/components/page-layout";
import { getTranslation } from "@/app/i18n";
import { CreatePoll } from "@/components/create-poll";

export default function Page() {
return <CreatePoll />;
return (
<PageContainer>
<PageContent>
<CreatePoll />
</PageContent>
</PageContainer>
);
}

export async function generateMetadata({
Expand Down
41 changes: 38 additions & 3 deletions apps/web/src/app/[locale]/(admin)/polls/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,44 @@
import { Button } from "@rallly/ui/button";
import { PenBoxIcon } from "lucide-react";
import Link from "next/link";
import { Trans } from "react-i18next/TransWithoutContext";

import {
PageContainer,
PageContent,
PageHeader,
PageTitle,
} from "@/app/components/page-layout";
import { getTranslation } from "@/app/i18n";

import { PollsPage } from "./polls-page";
import { PollsList } from "./polls-list";

export default function Page() {
return <PollsPage />;
export default async function Page({ params }: { params: { locale: string } }) {
const { t } = await getTranslation(params.locale);
return (
<PageContainer>
<PageHeader>
<div className="flex justify-between items-center gap-x-4">
<PageTitle>
<Trans t={t} i18nKey="polls" />
</PageTitle>
<Button asChild>
<Link href="/new">
<PenBoxIcon className="w-4 text-muted-foreground h-4" />
<span className="hidden sm:inline">
<Trans t={t} i18nKey="newPoll" />
</span>
</Link>
</Button>
</div>
</PageHeader>
<PageContent>
<div className="space-y-6">
<PollsList />
</div>
</PageContent>
</PageContainer>
);
}

export async function generateMetadata({
Expand Down
55 changes: 55 additions & 0 deletions apps/web/src/app/[locale]/(admin)/polls/polls-folders.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
"use client";

import { cn } from "@rallly/ui";
import { Button } from "@rallly/ui/button";
import Link from "next/link";
import { usePathname, useSearchParams } from "next/navigation";

import { Trans } from "@/components/trans";

function PollFolder({
href,
children,
}: {
href: string;
children: React.ReactNode;
}) {
const pathname = usePathname() ?? "";
const searchParams = useSearchParams();
const query = searchParams?.has("status")
? `?${searchParams?.toString()}`
: "";
const currentUrl = pathname + query;
const isActive = href === currentUrl;
return (
<Button
asChild
className={cn(
isActive
? "bg-gray-100"
: "shadow-sm text-muted-foreground hover:bg-gray-100 active:bg-gray-200",
)}
>
<Link href={href}>{children}</Link>
</Button>
);
}

export function PollFolders() {
return (
<div className="flex flex-wrap gap-3">
<PollFolder href="/polls">
<Trans i18nKey="pollStatusAll" defaults="All" />
</PollFolder>
<PollFolder href="/polls?status=live">
<Trans i18nKey="pollStatusLive" defaults="Live" />
</PollFolder>
<PollFolder href="/polls?status=paused">
<Trans i18nKey="pollStatusPaused" defaults="Paused" />
</PollFolder>
<PollFolder href="/polls?status=finalized">
<Trans i18nKey="pollStatusFinalized" defaults="Finalized" />
</PollFolder>
</div>
);
}
Loading
Loading