Skip to content

Commit

Permalink
perf: ⚡️ added sperate organization selection page
Browse files Browse the repository at this point in the history
Created seperate page for selecting and creating organiation, this will
allow us to prevent any  page break  where no organiization is cretated

✅ Closes: #169
  • Loading branch information
growupanand committed Feb 1, 2024
1 parent 891269f commit 40941cb
Show file tree
Hide file tree
Showing 20 changed files with 198 additions and 125 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ yarn-error.log*

# typescript
*.tsbuildinfo
next-env.d.ts

.env
# Sentry Config File
Expand Down
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"eslint.rules.customizations": [{ "rule": "*", "severity": "warn" }],
"eslint.workingDirectories": [
{ "pattern": "apps/*/" },
{ "pattern": "packages/*/" }
],
"[typescriptreact]": { // for .tsx files
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
}
5 changes: 5 additions & 0 deletions apps/web/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
34 changes: 14 additions & 20 deletions apps/web/src/app/(privatePage)/(mainPage)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import NavigationCardContent from "@/components/mainPage/navigationCardContent";
import NavigationMobileCard from "@/components/mainPage/navigationMobileCard";
import { getWorkspacesController } from "@/lib/controllers/workspace";
import { getOrganizationId } from "@/lib/getOrganizationId";
import Provider from "./provider";

type Props = {
children: React.ReactNode;
Expand All @@ -11,26 +9,22 @@ type Props = {
export default async function Layout({ children }: Readonly<Props>) {
const orgId = getOrganizationId();

const workspaces = await getWorkspacesController(orgId);

return (
<Provider workspaces={workspaces} orgId={orgId}>
<div className="flex h-screen flex-col lg:flex-row ">
{/* Mobile view */}
<div className="lg:hidden">
<NavigationMobileCard>
<NavigationCardContent />
</NavigationMobileCard>
</div>
<div className="flex h-screen flex-col lg:flex-row ">
{/* Mobile view */}
<div className="lg:hidden">
<NavigationMobileCard>
<NavigationCardContent orgId={orgId} />
</NavigationMobileCard>
</div>

{/* Desktop View */}
<div className="min-w-[300px] max-lg:hidden">
<NavigationCardContent />
</div>
<div className="h-full overflow-auto border-l bg-white px-3 lg:container lg:py-5">
{children}
</div>
{/* Desktop View */}
<div className="min-w-[300px] max-lg:hidden">
<NavigationCardContent orgId={orgId} />
</div>
<div className="h-full overflow-auto border-l bg-white px-3 lg:container lg:py-5">
{children}
</div>
</Provider>
</div>
);
}
25 changes: 0 additions & 25 deletions apps/web/src/app/(privatePage)/(mainPage)/provider.tsx

This file was deleted.

4 changes: 1 addition & 3 deletions apps/web/src/app/(privatePage)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { OrganizationRequired } from "@/components/wrappers/OrganizationRequired";

type Props = {
children: React.ReactNode;
};

export default function Layout({ children }: Props) {
return <OrganizationRequired>{children}</OrganizationRequired>;
return <>{children}</>;
}
35 changes: 35 additions & 0 deletions apps/web/src/app/(privatePage)/organizations/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { ClerkLoading, OrganizationList, UserButton } from "@clerk/nextjs";
import { Skeleton } from "@convoform/ui/components/ui/skeleton";

import BrandName from "@/components/common/brandName";
import Spinner from "@/components/common/spinner";

export default function Page() {
return (
<div className="flex h-screen flex-col items-center justify-between">
<div className="w-full border-b bg-white/70 shadow-sm backdrop-blur ">
<header className="container flex items-center justify-between p-3">
<BrandName className="text-xl lg:text-2xl" />
<div>
<ClerkLoading>
<Skeleton className="h-10 w-10 animate-pulse rounded-full" />
</ClerkLoading>
<UserButton />
</div>
</header>
</div>
<div>
<OrganizationList
afterSelectOrganizationUrl="/dashboard"
hidePersonal
/>
<ClerkLoading>
<div className="flex w-full justify-center">
<Spinner label="Please wait..." />
</div>
</ClerkLoading>
</div>
<div></div>
</div>
);
}
21 changes: 18 additions & 3 deletions apps/web/src/components/common/spinner.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { Loader2 } from "lucide-react";

import { cn } from "@/lib/utils";

type Props = {
Expand All @@ -10,7 +8,24 @@ type Props = {
export function Spinner({ className, label }: Readonly<Props>) {
return (
<div className="flex items-center justify-start gap-2">
<Loader2 className={cn("h-4 w-4 animate-spin ", className)} />
<svg
className={cn(
"mr-2 inline h-8 w-8 animate-spin fill-gray-500 text-gray-200 dark:text-gray-600",
className,
)}
viewBox="0 0 100 101"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
fill="currentColor"
/>
<path
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
fill="currentFill"
/>
</svg>
{label && <span>{label}</span>}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ export const FormEditorFormSkeleton = () => {

<Skeleton className="h-10 w-full" />
<br />
<Skeleton className="bg-primary h-[40px] w-full" />
<Skeleton className="h-[40px] w-full" />
</div>
);
};
Expand Down
6 changes: 5 additions & 1 deletion apps/web/src/components/landingPage/header.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { auth, UserButton } from "@clerk/nextjs";
import { auth, ClerkLoading, UserButton } from "@clerk/nextjs";
import { Button } from "@convoform/ui/components/ui/button";
import { Skeleton } from "@convoform/ui/components/ui/skeleton";
import { LayoutDashboard } from "lucide-react";

import { LinkN } from "@/components/common/linkN";
Expand All @@ -20,6 +21,9 @@ export function Header() {
<LayoutDashboard className="mr-2" size={20} /> Go to Dashboard
</Button>
</LinkN>
<ClerkLoading>
<Skeleton className="h-10 w-10 animate-pulse rounded-full" />
</ClerkLoading>
<UserButton />
</>
) : (
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/mainPage/dashboard/dataCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ export const DataCardSkeleton = () => {
return (
<Card className="h-[130px]">
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
<Skeleton className="h-2 w-20 bg-gray-300" />
<Skeleton className="h-2 w-20" />
</CardHeader>
<CardContent>
<Skeleton className="mb-2 h-10 w-6 bg-gray-700" />
<Skeleton className="mb-2 h-10 w-6" />
<div className="flex items-center gap-2">
<Skeleton className="h-2 w-10" />
<Skeleton className="h-2 w-10" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const NavigationLinkItem = ({ isActive, href, name }: Props) => {
const NavigationLinkItemSkeleton = () => {
return (
<Button variant="link" className="w-full justify-start py-0">
<Skeleton className="h-2 w-20 bg-gray-300" />
<Skeleton className="h-2 w-20" />
</Button>
);
};
Expand Down

0 comments on commit 40941cb

Please sign in to comment.