Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: always show upload and scratch in create template gallery#14327

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
aslilac merged 2 commits intomainfromfix-create-template-gallery-page
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes fromall 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 numberDiff line numberDiff line change
Expand Up@@ -8,11 +8,11 @@ import {
MockTemplateExample2,
} from "testHelpers/entities";
import { server } from "testHelpers/server";
importStarterTemplatesPage from "./CreateTemplatesGalleryPage";
importCreateTemplateGalleryPage 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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<typeofStarterTemplatesPageView> = {
title: "pages/StarterTemplatesPage",
const meta: Meta<typeofCreateTemplateGalleryPageView> = {
title: "pages/CreateTemplateGalleryPage",
parameters: { chromatic },
component:StarterTemplatesPageView,
component:CreateTemplateGalleryPageView,
};

export default meta;
type Story = StoryObj<typeofStarterTemplatesPageView>;
type Story = StoryObj<typeofCreateTemplateGalleryPageView>;

export const Example: Story = {
args: {
Expand Down
Original file line numberDiff line numberDiff 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 interfaceCreateTemplatePageViewProps {
export interfaceCreateTemplateGalleryPageViewProps {
starterTemplatesByTag?: StarterTemplatesByTag;
error?: unknown;
}

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

This file was deleted.

6 changes: 3 additions & 3 deletionssite/src/router.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -169,8 +169,8 @@ const TemplateVersionPage = lazy(
const TemplateVersionEditorPage = lazy(
() => import("./pages/TemplateVersionEditorPage/TemplateVersionEditorPage"),
);
constCreateTemplatesGalleryPage = lazy(
() => import("./pages/CreateTemplatesGalleryPage/CreateTemplatesGalleryPage"),
constCreateTemplateGalleryPage = lazy(
() => import("./pages/CreateTemplateGalleryPage/CreateTemplateGalleryPage"),
);
const StarterTemplatePage = lazy(
() => import("pages/StarterTemplatePage/StarterTemplatePage"),
Expand DownExpand 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

[8]ページ先頭

©2009-2025 Movatter.jp