From fe8c1fbc476201be6a2817525df59ba5982de2bb Mon Sep 17 00:00:00 2001
From: Pratik <54103265+PratikAwaik@users.noreply.github.com>
Date: Fri, 11 Oct 2024 04:46:16 +0530
Subject: [PATCH] feat: product configuration pages loading skeletons (#3262)
Co-authored-by: Johannes <72809645+jobenjada@users.noreply.github.com>
---
apps/web/app/(app)/components/LoadingCard.tsx | 24 ++
.../(setup)/app-connection/loading.tsx | 146 ++------
.../product/(setup)/app-connection/page.tsx | 12 +-
.../product/api-keys/loading.tsx | 91 +----
.../components/ProductConfigNavigation.tsx | 10 +-
.../product/general/loading.tsx | 111 +-----
.../product/languages/loading.tsx | 33 ++
.../[environmentId]/product/look/loading.tsx | 319 +++++++-----------
.../[environmentId]/product/tags/loading.tsx | 42 +++
.../components/AccountSettingsNavbar.tsx | 6 +-
.../(account)/notifications/loading.tsx | 51 +--
.../settings/(account)/profile/loading.tsx | 51 +--
.../components/OrganizationSettingsNavbar.tsx | 6 +-
.../(organization)/enterprise/loading.tsx | 31 +-
.../(organization)/members/loading.tsx | 54 +--
.../(organization)/billing/loading.tsx | 31 +-
.../components/edit-language.tsx | 34 +-
.../components/language-labels.tsx | 32 ++
18 files changed, 372 insertions(+), 712 deletions(-)
create mode 100644 apps/web/app/(app)/components/LoadingCard.tsx
create mode 100644 apps/web/app/(app)/environments/[environmentId]/product/languages/loading.tsx
create mode 100644 apps/web/app/(app)/environments/[environmentId]/product/tags/loading.tsx
create mode 100644 packages/ee/multi-language/components/language-labels.tsx
diff --git a/apps/web/app/(app)/components/LoadingCard.tsx b/apps/web/app/(app)/components/LoadingCard.tsx
new file mode 100644
index 0000000000..be6d80c073
--- /dev/null
+++ b/apps/web/app/(app)/components/LoadingCard.tsx
@@ -0,0 +1,24 @@
+import { SettingsCard } from "@/app/(app)/environments/[environmentId]/settings/components/SettingsCard";
+import { cn } from "@formbricks/lib/cn";
+
+export const LoadingCard = ({
+ title,
+ description,
+ skeletonLines,
+}: {
+ title: string;
+ description: string;
+ skeletonLines: Array<{ classes: string }>;
+}) => {
+ return (
+
+
+ {skeletonLines.map((line, index) => (
+
+ ))}
+
+
+ );
+};
diff --git a/apps/web/app/(app)/environments/[environmentId]/product/(setup)/app-connection/loading.tsx b/apps/web/app/(app)/environments/[environmentId]/product/(setup)/app-connection/loading.tsx
index 9e23ba1582..14b4abf000 100644
--- a/apps/web/app/(app)/environments/[environmentId]/product/(setup)/app-connection/loading.tsx
+++ b/apps/web/app/(app)/environments/[environmentId]/product/(setup)/app-connection/loading.tsx
@@ -1,138 +1,46 @@
"use client";
-import { BrushIcon, KeyIcon, LanguagesIcon, ListChecksIcon, TagIcon, UsersIcon } from "lucide-react";
-import { usePathname } from "next/navigation";
-import { cn } from "@formbricks/lib/cn";
+import { LoadingCard } from "@/app/(app)/components/LoadingCard";
+import { ProductConfigNavigation } from "@/app/(app)/environments/[environmentId]/product/components/ProductConfigNavigation";
import { PageContentWrapper } from "@formbricks/ui/components/PageContentWrapper";
import { PageHeader } from "@formbricks/ui/components/PageHeader";
-const LoadingCard = ({ title, description, skeletonLines }) => {
- return (
-
-
@@ -37,85 +35,14 @@ const LoadingCard = () => {
};
const Loading = () => {
- const pathname = usePathname();
-
- let navigation = [
- {
- id: "general",
- label: "General",
- icon:
,
- current: pathname?.includes("/general"),
- },
- {
- id: "look",
- label: "Look & Feel",
- icon:
,
- current: pathname?.includes("/look"),
- },
- {
- id: "languages",
- label: "Survey Languages",
- icon:
,
- hidden: true,
- current: pathname?.includes("/languages"),
- },
- {
- id: "tags",
- label: "Tags",
- icon:
,
- current: pathname?.includes("/tags"),
- },
- {
- id: "api-keys",
- label: "API Keys",
- icon:
,
- current: pathname?.includes("/api-keys"),
- },
- {
- id: "website-connection",
- label: "Website Connection",
- icon:
,
- current: pathname?.includes("/website-connection"),
- hidden: true,
- },
- {
- id: "app-connection",
- label: "App Connection",
- icon:
,
- current: pathname?.includes("/app-connection"),
- hidden: true,
- },
- ];
-
return (
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
);
};
diff --git a/apps/web/app/(app)/environments/[environmentId]/product/components/ProductConfigNavigation.tsx b/apps/web/app/(app)/environments/[environmentId]/product/components/ProductConfigNavigation.tsx
index 3086183502..9fa6d6ea04 100644
--- a/apps/web/app/(app)/environments/[environmentId]/product/components/ProductConfigNavigation.tsx
+++ b/apps/web/app/(app)/environments/[environmentId]/product/components/ProductConfigNavigation.tsx
@@ -5,15 +5,17 @@ import { usePathname } from "next/navigation";
import { SecondaryNavigation } from "@formbricks/ui/components/SecondaryNavigation";
interface ProductConfigNavigationProps {
- environmentId: string;
activeId: string;
- isMultiLanguageAllowed: boolean;
+ environmentId?: string;
+ isMultiLanguageAllowed?: boolean;
+ loading?: boolean;
}
export const ProductConfigNavigation = ({
- environmentId,
activeId,
+ environmentId,
isMultiLanguageAllowed,
+ loading,
}: ProductConfigNavigationProps) => {
const pathname = usePathname();
let navigation = [
@@ -62,5 +64,5 @@ export const ProductConfigNavigation = ({
},
];
- return
;
+ return
;
};
diff --git a/apps/web/app/(app)/environments/[environmentId]/product/general/loading.tsx b/apps/web/app/(app)/environments/[environmentId]/product/general/loading.tsx
index 003e74e32d..5fc318e862 100644
--- a/apps/web/app/(app)/environments/[environmentId]/product/general/loading.tsx
+++ b/apps/web/app/(app)/environments/[environmentId]/product/general/loading.tsx
@@ -1,34 +1,11 @@
"use client";
-import { BrushIcon, KeyIcon, LanguagesIcon, ListChecksIcon, TagIcon, UsersIcon } from "lucide-react";
-import { usePathname } from "next/navigation";
-import { cn } from "@formbricks/lib/cn";
+import { LoadingCard } from "@/app/(app)/components/LoadingCard";
+import { ProductConfigNavigation } from "@/app/(app)/environments/[environmentId]/product/components/ProductConfigNavigation";
import { PageContentWrapper } from "@formbricks/ui/components/PageContentWrapper";
import { PageHeader } from "@formbricks/ui/components/PageHeader";
-const LoadingCard = ({ title, description, skeletonLines }) => {
- return (
-
-
-
{title}
-
{description}
-
-
-
- {skeletonLines.map((line, index) => (
-
- ))}
-
-
-
- );
-};
-
const Loading = () => {
- const pathname = usePathname();
-
const cards = [
{
title: "Product Name",
@@ -48,83 +25,15 @@ const Loading = () => {
},
];
- let navigation = [
- {
- id: "general",
- label: "General",
- icon:
,
- current: pathname?.includes("/general"),
- },
- {
- id: "look",
- label: "Look & Feel",
- icon:
,
- current: pathname?.includes("/look"),
- },
- {
- id: "languages",
- label: "Survey Languages",
- icon:
,
- hidden: true,
- current: pathname?.includes("/languages"),
- },
- {
- id: "tags",
- label: "Tags",
- icon:
,
- current: pathname?.includes("/tags"),
- },
- {
- id: "api-keys",
- label: "API Keys",
- icon:
,
- current: pathname?.includes("/api-keys"),
- },
- {
- id: "website-connection",
- label: "Website Connection",
- icon:
,
- current: pathname?.includes("/website-connection"),
- hidden: true,
- },
- {
- id: "app-connection",
- label: "App Connection",
- icon:
,
- current: pathname?.includes("/app-connection"),
- hidden: true,
- },
- ];
-
return (
-
-
-
-
-
-
-
-
- {cards.map((card, index) => (
-
- ))}
-
-
+
+
+
+
+ {cards.map((card, index) => (
+
+ ))}
+
);
};
diff --git a/apps/web/app/(app)/environments/[environmentId]/product/languages/loading.tsx b/apps/web/app/(app)/environments/[environmentId]/product/languages/loading.tsx
new file mode 100644
index 0000000000..f5e2b5dd26
--- /dev/null
+++ b/apps/web/app/(app)/environments/[environmentId]/product/languages/loading.tsx
@@ -0,0 +1,33 @@
+"use client";
+
+import { ProductConfigNavigation } from "@/app/(app)/environments/[environmentId]/product/components/ProductConfigNavigation";
+import { SettingsCard } from "@/app/(app)/environments/[environmentId]/settings/components/SettingsCard";
+import { LanguageLabels } from "@formbricks/ee/multi-language/components/language-labels";
+import { PageContentWrapper } from "@formbricks/ui/components/PageContentWrapper";
+import { PageHeader } from "@formbricks/ui/components/PageHeader";
+
+const Loading = () => {
+ return (
+
+
+
+
+
+
+
+ {[...Array(3)].map((_, idx) => (
+
+ ))}
+
+
+
+ );
+};
+
+export default Loading;
diff --git a/apps/web/app/(app)/environments/[environmentId]/product/look/loading.tsx b/apps/web/app/(app)/environments/[environmentId]/product/look/loading.tsx
index 7a65221abf..d00e3ae99d 100644
--- a/apps/web/app/(app)/environments/[environmentId]/product/look/loading.tsx
+++ b/apps/web/app/(app)/environments/[environmentId]/product/look/loading.tsx
@@ -1,8 +1,7 @@
"use client";
+import { ProductConfigNavigation } from "@/app/(app)/environments/[environmentId]/product/components/ProductConfigNavigation";
import { SettingsCard } from "@/app/(app)/environments/[environmentId]/settings/components/SettingsCard";
-import { BrushIcon, KeyIcon, LanguagesIcon, ListChecksIcon, TagIcon, UsersIcon } from "lucide-react";
-import { usePathname } from "next/navigation";
import { cn } from "@formbricks/lib/cn";
import { Badge } from "@formbricks/ui/components/Badge";
import { Button } from "@formbricks/ui/components/Button";
@@ -21,202 +20,140 @@ const placements = [
];
const Loading = () => {
- const pathname = usePathname();
-
- let navigation = [
- {
- id: "general",
- label: "General",
- icon:
,
- current: pathname?.includes("/general"),
- },
- {
- id: "look",
- label: "Look & Feel",
- icon:
,
- current: pathname?.includes("/look"),
- },
- {
- id: "languages",
- label: "Survey Languages",
- icon:
,
- hidden: true,
- current: pathname?.includes("/languages"),
- },
- {
- id: "tags",
- label: "Tags",
- icon:
,
- current: pathname?.includes("/tags"),
- },
- {
- id: "api-keys",
- label: "API Keys",
- icon:
,
- current: pathname?.includes("/api-keys"),
- },
- {
- id: "website-connection",
- label: "Website Connection",
- icon:
,
- current: pathname?.includes("/website-connection"),
- hidden: true,
- },
- {
- id: "app-connection",
- label: "App Connection",
- icon:
,
- current: pathname?.includes("/app-connection"),
- hidden: true,
- },
- ];
-
return (
-
-
-
-
-