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

Commite70ad2b

Browse files
authored
fix: always show upload and scratch in create template gallery (#14327)
1 parent5246f8d commite70ad2b

File tree

7 files changed

+20
-69
lines changed

7 files changed

+20
-69
lines changed

‎site/src/pages/CreateTemplatesGalleryPage/StarterTemplatesPage.test.tsxrenamed to‎site/src/pages/CreateTemplateGalleryPage/CreateTemplateGalleryPage.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import {
88
MockTemplateExample2,
99
}from"testHelpers/entities";
1010
import{server}from"testHelpers/server";
11-
importStarterTemplatesPagefrom"./CreateTemplatesGalleryPage";
11+
importCreateTemplateGalleryPagefrom"./CreateTemplateGalleryPage";
1212

1313
test("does not display the scratch template",async()=>{
1414
server.use(
15-
http.get("api/v2/organizations/:organizationId/templates/examples",()=>{
15+
http.get("api/v2/templates/examples",()=>{
1616
returnHttpResponse.json([
1717
MockTemplateExample,
1818
MockTemplateExample2,
@@ -36,7 +36,7 @@ test("does not display the scratch template", async () => {
3636
children:[
3737
{
3838
path:"/starter-templates",
39-
element:<StarterTemplatesPage/>,
39+
element:<CreateTemplateGalleryPage/>,
4040
},
4141
],
4242
},

‎site/src/pages/CreateTemplatesGalleryPage/CreateTemplatesGalleryPage.tsxrenamed to‎site/src/pages/CreateTemplateGalleryPage/CreateTemplateGalleryPage.tsx

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
import{templateExamples}from"api/queries/templates";
22
importtype{TemplateExample}from"api/typesGenerated";
3-
import{useDashboard}from"modules/dashboard/useDashboard";
43
importtype{FC}from"react";
54
import{Helmet}from"react-helmet-async";
65
import{useQuery}from"react-query";
76
import{pageTitle}from"utils/page";
87
import{getTemplatesByTag}from"utils/starterTemplates";
9-
import{CreateTemplatesPageView}from"./CreateTemplatesPageView";
10-
import{StarterTemplatesPageView}from"./StarterTemplatesPageView";
8+
import{CreateTemplateGalleryPageView}from"./CreateTemplateGalleryPageView";
119

1210
constCreateTemplatesGalleryPage:FC=()=>{
13-
const{ showOrganizations}=useDashboard();
1411
consttemplateExamplesQuery=useQuery(templateExamples());
1512
conststarterTemplatesByTag=templateExamplesQuery.data
1613
?// Currently, the scratch template should not be displayed on the starter templates page.
@@ -22,17 +19,10 @@ const CreateTemplatesGalleryPage: FC = () => {
2219
<Helmet>
2320
<title>{pageTitle("Create a Template")}</title>
2421
</Helmet>
25-
{showOrganizations ?(
26-
<CreateTemplatesPageView
27-
error={templateExamplesQuery.error}
28-
starterTemplatesByTag={starterTemplatesByTag}
29-
/>
30-
) :(
31-
<StarterTemplatesPageView
32-
error={templateExamplesQuery.error}
33-
starterTemplatesByTag={starterTemplatesByTag}
34-
/>
35-
)}
22+
<CreateTemplateGalleryPageView
23+
error={templateExamplesQuery.error}
24+
starterTemplatesByTag={starterTemplatesByTag}
25+
/>
3626
</>
3727
);
3828
};

‎site/src/pages/CreateTemplatesGalleryPage/StarterTemplatesPageView.stories.tsxrenamed to‎site/src/pages/CreateTemplateGalleryPage/CreateTemplateGalleryPageView.stories.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ import {
66
mockApiError,
77
}from"testHelpers/entities";
88
import{getTemplatesByTag}from"utils/starterTemplates";
9-
import{StarterTemplatesPageView}from"./StarterTemplatesPageView";
9+
import{CreateTemplateGalleryPageView}from"./CreateTemplateGalleryPageView";
1010

11-
constmeta:Meta<typeofStarterTemplatesPageView>={
12-
title:"pages/StarterTemplatesPage",
11+
constmeta:Meta<typeofCreateTemplateGalleryPageView>={
12+
title:"pages/CreateTemplateGalleryPage",
1313
parameters:{ chromatic},
14-
component:StarterTemplatesPageView,
14+
component:CreateTemplateGalleryPageView,
1515
};
1616

1717
exportdefaultmeta;
18-
typeStory=StoryObj<typeofStarterTemplatesPageView>;
18+
typeStory=StoryObj<typeofCreateTemplateGalleryPageView>;
1919

2020
exportconstExample:Story={
2121
args:{

‎site/src/pages/CreateTemplatesGalleryPage/CreateTemplatesPageView.tsxrenamed to‎site/src/pages/CreateTemplateGalleryPage/CreateTemplateGalleryPageView.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@ import { Link as RouterLink } from "react-router-dom";
1313
importtype{StarterTemplatesByTag}from"utils/starterTemplates";
1414
import{StarterTemplates}from"./StarterTemplates";
1515

16-
exportinterfaceCreateTemplatePageViewProps{
16+
exportinterfaceCreateTemplateGalleryPageViewProps{
1717
starterTemplatesByTag?:StarterTemplatesByTag;
1818
error?:unknown;
1919
}
2020

21-
exportconstCreateTemplatesPageView:FC<CreateTemplatePageViewProps>=({
22-
starterTemplatesByTag,
23-
error,
24-
})=>{
21+
exportconstCreateTemplateGalleryPageView:FC<
22+
CreateTemplateGalleryPageViewProps
23+
>=({ starterTemplatesByTag, error})=>{
2524
return(
2625
<Margins>
2726
<PageHeader>

‎site/src/pages/CreateTemplatesGalleryPage/StarterTemplatesPageView.tsx

Lines changed: 0 additions & 38 deletions
This file was deleted.

‎site/src/router.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ const TemplateVersionPage = lazy(
169169
constTemplateVersionEditorPage=lazy(
170170
()=>import("./pages/TemplateVersionEditorPage/TemplateVersionEditorPage"),
171171
);
172-
constCreateTemplatesGalleryPage=lazy(
173-
()=>import("./pages/CreateTemplatesGalleryPage/CreateTemplatesGalleryPage"),
172+
constCreateTemplateGalleryPage=lazy(
173+
()=>import("./pages/CreateTemplateGalleryPage/CreateTemplateGalleryPage"),
174174
);
175175
constStarterTemplatePage=lazy(
176176
()=>import("pages/StarterTemplatePage/StarterTemplatePage"),
@@ -359,7 +359,7 @@ export const router = createBrowserRouter(
359359
<Routepath="/workspaces"element={<WorkspacesPage/>}/>
360360

361361
<Routepath="/starter-templates">
362-
<Routeindexelement={<CreateTemplatesGalleryPage/>}/>
362+
<Routeindexelement={<CreateTemplateGalleryPage/>}/>
363363
<Routepath=":exampleId"element={<StarterTemplatePage/>}/>
364364
</Route>
365365

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp