Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import {
MockTemplateExample2,
} from "testHelpers/entities";
import { server } from "testHelpers/server";
import StarterTemplatesPage from "./CreateTemplatesGalleryPage";
import CreateTemplateGalleryPage from "./CreateTemplateGalleryPage";

test("does not display the scratch template", async () => {
server.use(
http.get("api/v2/organizations/:organizationId/templates/examples", () => {
http.get("api/v2/templates/examples", () => {
return HttpResponse.json([
MockTemplateExample,
MockTemplateExample2,
Expand All @@ -36,7 +36,7 @@ test("does not display the scratch template", async () => {
children: [
{
path: "/starter-templates",
element: <StarterTemplatesPage />,
element: <CreateTemplateGalleryPage />,
},
],
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import { templateExamples } from "api/queries/templates";
import type { TemplateExample } from "api/typesGenerated";
import { useDashboard } from "modules/dashboard/useDashboard";
import type { FC } from "react";
import { Helmet } from "react-helmet-async";
import { useQuery } from "react-query";
import { pageTitle } from "utils/page";
import { getTemplatesByTag } from "utils/starterTemplates";
import { CreateTemplatesPageView } from "./CreateTemplatesPageView";
import { StarterTemplatesPageView } from "./StarterTemplatesPageView";
import { CreateTemplateGalleryPageView } from "./CreateTemplateGalleryPageView";

const CreateTemplatesGalleryPage: FC = () => {
const { showOrganizations } = useDashboard();
const templateExamplesQuery = useQuery(templateExamples());
const starterTemplatesByTag = templateExamplesQuery.data
? // Currently, the scratch template should not be displayed on the starter templates page.
Expand All @@ -22,17 +19,10 @@ const CreateTemplatesGalleryPage: FC = () => {
<Helmet>
<title>{pageTitle("Create a Template")}</title>
</Helmet>
{showOrganizations ? (
<CreateTemplatesPageView
error={templateExamplesQuery.error}
starterTemplatesByTag={starterTemplatesByTag}
/>
) : (
<StarterTemplatesPageView
error={templateExamplesQuery.error}
starterTemplatesByTag={starterTemplatesByTag}
/>
)}
<CreateTemplateGalleryPageView
error={templateExamplesQuery.error}
starterTemplatesByTag={starterTemplatesByTag}
/>
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ import {
mockApiError,
} from "testHelpers/entities";
import { getTemplatesByTag } from "utils/starterTemplates";
import { StarterTemplatesPageView } from "./StarterTemplatesPageView";
import { CreateTemplateGalleryPageView } from "./CreateTemplateGalleryPageView";

const meta: Meta<typeof StarterTemplatesPageView> = {
title: "pages/StarterTemplatesPage",
const meta: Meta<typeof CreateTemplateGalleryPageView> = {
title: "pages/CreateTemplateGalleryPage",
parameters: { chromatic },
component: StarterTemplatesPageView,
component: CreateTemplateGalleryPageView,
};

export default meta;
type Story = StoryObj<typeof StarterTemplatesPageView>;
type Story = StoryObj<typeof CreateTemplateGalleryPageView>;

export const Example: Story = {
args: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ import { Link as RouterLink } from "react-router-dom";
import type { StarterTemplatesByTag } from "utils/starterTemplates";
import { StarterTemplates } from "./StarterTemplates";

export interface CreateTemplatePageViewProps {
export interface CreateTemplateGalleryPageViewProps {
starterTemplatesByTag?: StarterTemplatesByTag;
error?: unknown;
}

export const CreateTemplatesPageView: FC<CreateTemplatePageViewProps> = ({
starterTemplatesByTag,
error,
}) => {
export const CreateTemplateGalleryPageView: FC<
CreateTemplateGalleryPageViewProps
> = ({ starterTemplatesByTag, error }) => {
return (
<Margins>
<PageHeader>
Expand Down

This file was deleted.

6 changes: 3 additions & 3 deletions site/src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ const TemplateVersionPage = lazy(
const TemplateVersionEditorPage = lazy(
() => import("./pages/TemplateVersionEditorPage/TemplateVersionEditorPage"),
);
const CreateTemplatesGalleryPage = lazy(
() => import("./pages/CreateTemplatesGalleryPage/CreateTemplatesGalleryPage"),
const CreateTemplateGalleryPage = lazy(
() => import("./pages/CreateTemplateGalleryPage/CreateTemplateGalleryPage"),
);
const StarterTemplatePage = lazy(
() => import("pages/StarterTemplatePage/StarterTemplatePage"),
Expand Down Expand Up @@ -359,7 +359,7 @@ export const router = createBrowserRouter(
<Route path="/workspaces" element={<WorkspacesPage />} />

<Route path="/starter-templates">
<Route index element={<CreateTemplatesGalleryPage />} />
<Route index element={<CreateTemplateGalleryPage />} />
<Route path=":exampleId" element={<StarterTemplatePage />} />
</Route>

Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy