PWA Settings
Fixed webmanifest generation and pwa icon. Made nav bar text optional.
This commit is contained in:
23 files changed
+1065
-91
No files matched your search
+15
-5
@@ -5,7 +5,7 @@ import { auth } from "@/auth";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { getBranding } from "@/lib/business/branding";
|
||||
import { getPrimaryBusiness } from "@/lib/business/get-primary-business";
|
||||
import { hasPermission } from "@/lib/auth/permissions";
|
||||
import { hasPermission, isSuperAdmin } from "@/lib/auth/permissions";
|
||||
import { Permission } from "@/generated/prisma/enums";
|
||||
import { prisma } from "@/lib/db/prisma";
|
||||
import { WelcomeInstallCard } from "@/features/pwa/components/welcome-install-card";
|
||||
@@ -14,10 +14,14 @@ import { WelcomeInstallCard } from "@/features/pwa/components/welcome-install-ca
|
||||
* The unauthenticated entry point — always shown at `/` before
|
||||
* authentication, per the brief's "Welcome routing" requirements.
|
||||
* Authenticated visitors never see it: they're routed straight to their
|
||||
* role's home (customer → /home, barber → /staff, owner → /owner) below.
|
||||
* Unreachable at all before installation completes — src/proxy.ts
|
||||
* redirects every non-exempt route (including this one) to /install
|
||||
* until ApplicationInstallation flips to INSTALLED.
|
||||
* role's calendar (barber → /staff, owner/super admin → /owner/calendar)
|
||||
* or customer home below. This is also where a bare sign-in with no
|
||||
* `callbackUrl` ends up — see safeRedirectPath's fallback in
|
||||
* sign-in-form.tsx — so it's the one place that has to get every role
|
||||
* right, not just staffProfile holders. Unreachable at all before
|
||||
* installation completes — src/proxy.ts redirects every non-exempt route
|
||||
* (including this one) to /install until ApplicationInstallation flips
|
||||
* to INSTALLED.
|
||||
*/
|
||||
export default async function WelcomePage() {
|
||||
const session = await auth();
|
||||
@@ -27,6 +31,12 @@ export default async function WelcomePage() {
|
||||
const canManageStaff = await hasPermission(session.user.id, Permission.MANAGE_STAFF);
|
||||
redirect(canManageStaff ? "/owner" : "/staff");
|
||||
}
|
||||
// A Super Administrator has no StaffProfile by design (see
|
||||
// isSuperAdmin) — without this check they'd fall through to the
|
||||
// customer /home below instead of the staff shell + Calendar tab
|
||||
// their nav role (see lib/navigation/nav-config.ts) actually gives
|
||||
// them once they land somewhere in it.
|
||||
if (await isSuperAdmin(session.user.id)) redirect("/owner/calendar");
|
||||
redirect("/home");
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user