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

Commit7af96f2

Browse files
committed
fix: fix formatting
1 parentb29246d commit7af96f2

File tree

6 files changed

+93
-77
lines changed

6 files changed

+93
-77
lines changed

‎site/src/api/queries/templates.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,19 @@ export const templateByName = (
3030
};
3131
};
3232

33-
constgetTemplatesByOrganizationIdQueryKey=(organizationId:string,deprecated?:boolean)=>[
34-
organizationId,
35-
"templates",
36-
deprecated,
37-
];
33+
constgetTemplatesByOrganizationIdQueryKey=(
34+
organizationId:string,
35+
deprecated?:boolean,
36+
)=>[organizationId,"templates",deprecated];
3837

39-
exportconsttemplatesByOrganizationId=(organizationId:string,deprecated?:boolean)=>{
38+
exportconsttemplatesByOrganizationId=(
39+
organizationId:string,
40+
deprecated?:boolean,
41+
)=>{
4042
return{
4143
queryKey:getTemplatesByOrganizationIdQueryKey(organizationId,deprecated),
42-
queryFn:()=>API.getTemplatesByOrganizationId(organizationId,{ deprecated}),
44+
queryFn:()=>
45+
API.getTemplatesByOrganizationId(organizationId,{ deprecated}),
4346
};
4447
};
4548

@@ -104,7 +107,10 @@ export const setGroupRole = (
104107

105108
exportconsttemplateExamples=(organizationId:string)=>{
106109
return{
107-
queryKey:[...getTemplatesByOrganizationIdQueryKey(organizationId),"examples"],
110+
queryKey:[
111+
...getTemplatesByOrganizationIdQueryKey(organizationId),
112+
"examples",
113+
],
108114
queryFn:()=>API.getTemplateExamples(organizationId),
109115
};
110116
};
Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
importtype{Meta,StoryObj}from"@storybook/react";
22
import{chromatic}from"testHelpers/chromatic";
3-
import{
4-
MockTemplate,
5-
}from"testHelpers/entities";
3+
import{MockTemplate}from"testHelpers/entities";
64
import{TemplateCard}from"./TemplateCard";
75

86
constmeta:Meta<typeofTemplateCard>={
@@ -19,21 +17,24 @@ type Story = StoryObj<typeof TemplateCard>;
1917

2018
exportconstTemplate:Story={};
2119

22-
exportconstDeprecatedTemplate:Story={args:{
23-
template:{
24-
...MockTemplate,
25-
deprecated:true
26-
}
27-
},};
20+
exportconstDeprecatedTemplate:Story={
21+
args:{
22+
template:{
23+
...MockTemplate,
24+
deprecated:true,
25+
},
26+
},
27+
};
2828

2929
exportconstLongContentTemplate:Story={
3030
args:{
3131
template:{
3232
...MockTemplate,
33-
display_name:'Very Long Template Name',
34-
organization_name:'Very Long Organization Name',
35-
description:'This is a very long test description. This is a very long test description. This is a very long test description. This is a very long test description',
36-
active_user_count:999
37-
}
33+
display_name:"Very Long Template Name",
34+
organization_name:"Very Long Organization Name",
35+
description:
36+
"This is a very long test description. This is a very long test description. This is a very long test description. This is a very long test description",
37+
active_user_count:999,
38+
},
3839
},
3940
};

‎site/src/modules/templates/TemplateCard/TemplateCard.tsx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const TemplateCard: FC<TemplateCardProps> = ({
2121
return(
2222
<divcss={styles.card}{...divProps}>
2323
<divcss={styles.header}>
24-
<div>
24+
<div>
2525
<AvatarData
2626
title={
2727
template.display_name.length>0
@@ -37,7 +37,8 @@ export const TemplateCard: FC<TemplateCardProps> = ({
3737
/>
3838
</div>
3939
<div>
40-
{template.active_user_count}{template.active_user_count===1 ?"user" :"users"}
40+
{template.active_user_count}{" "}
41+
{template.active_user_count===1 ?"user" :"users"}
4142
</div>
4243
</div>
4344

@@ -52,16 +53,16 @@ export const TemplateCard: FC<TemplateCardProps> = ({
5253
<DeprecatedBadge/>
5354
) :(
5455
<Button
55-
component={RouterLink}
56-
css={styles.actionButton}
57-
className="actionButton"
58-
fullWidth
59-
startIcon={<ArrowForwardOutlined/>}
60-
title={`Create a workspace using the${template.display_name} template`}
61-
to={`/templates/${template.name}/workspace`}
62-
>
63-
Create Workspace
64-
</Button>
56+
component={RouterLink}
57+
css={styles.actionButton}
58+
className="actionButton"
59+
fullWidth
60+
startIcon={<ArrowForwardOutlined/>}
61+
title={`Create a workspace using the${template.display_name} template`}
62+
to={`/templates/${template.name}/workspace`}
63+
>
64+
Create Workspace
65+
</Button>
6566
)}
6667
</div>
6768
</div>

‎site/src/pages/TemplatesPage/MultiOrgTemplatePage/TemplatesPageView.tsx

Lines changed: 34 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,21 @@ export type TemplatesByOrg = Record<string, number>;
5959

6060
constgetTemplatesByOrg=(templates:Template[]):TemplatesByOrg=>{
6161
constorgs:TemplatesByOrg={
62-
all:0
63-
}
62+
all:0,
63+
};
6464

6565
templates.forEach((template)=>{
6666
if(orgs[template.organization_name]){
67-
orgs[template.organization_name]+=1
67+
orgs[template.organization_name]+=1;
6868
}else{
6969
orgs[template.organization_name]=1;
7070
}
7171

7272
orgs.all+=1;
73-
})
73+
});
7474

7575
returnorgs;
76-
}
76+
};
7777

7878
exportconstTemplatesPageView:FC<TemplatesPageViewProps>=({
7979
templates,
@@ -112,24 +112,19 @@ export const TemplatesPageView: FC<TemplatesPageViewProps> = ({
112112
{Boolean(error)&&<ErrorAlerterror={error}/>}
113113

114114
<Stackdirection="row"spacing={4}alignItems="flex-start">
115-
<Stack
116-
css={{width:208,flexShrink:0,position:"sticky",top:48}}
117-
>
118-
<spancss={styles.filterCaption}>ORGANIZATION</span>
119-
{Object.keys(templatesByOrg).map((org)=>(
120-
<Link
121-
key={org}
122-
to={`?org=${org}`}
123-
css={[
124-
styles.tagLink,
125-
org===activeOrg&&styles.tagLinkActive,
126-
]}
127-
>
128-
{org==='all' ?'All Organizations' :org} ({templatesByOrg[org]??0})
129-
</Link>
130-
))}
131-
</Stack>
132-
115+
<Stackcss={{width:208,flexShrink:0,position:"sticky",top:48}}>
116+
<spancss={styles.filterCaption}>ORGANIZATION</span>
117+
{Object.keys(templatesByOrg).map((org)=>(
118+
<Link
119+
key={org}
120+
to={`?org=${org}`}
121+
css={[styles.tagLink,org===activeOrg&&styles.tagLinkActive]}
122+
>
123+
{org==="all" ?"All Organizations" :org} (
124+
{templatesByOrg[org]??0})
125+
</Link>
126+
))}
127+
</Stack>
133128

134129
<div
135130
css={{
@@ -140,20 +135,22 @@ export const TemplatesPageView: FC<TemplatesPageViewProps> = ({
140135
}}
141136
>
142137
{isEmpty ?(
143-
<EmptyTemplates
144-
canCreateTemplates={canCreateTemplates}
145-
examples={examples??[]}
146-
/>
147-
) :(templates&&
148-
templates.map((template)=>(
149-
<TemplateCard
150-
css={(theme)=>({
151-
backgroundColor:theme.palette.background.paper,
152-
})}
153-
template={template}
154-
key={template.id}
155-
/>
156-
)))}
138+
<EmptyTemplates
139+
canCreateTemplates={canCreateTemplates}
140+
examples={examples??[]}
141+
/>
142+
) :(
143+
templates&&
144+
templates.map((template)=>(
145+
<TemplateCard
146+
css={(theme)=>({
147+
backgroundColor:theme.palette.background.paper,
148+
})}
149+
template={template}
150+
key={template.id}
151+
/>
152+
))
153+
)}
157154
</div>
158155
</Stack>
159156
</Margins>

‎site/src/pages/TemplatesPage/TemplatesPage.tsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
importtype{FC}from"react";
22
import{Helmet}from"react-helmet-async";
33
import{useQuery}from"react-query";
4-
import{templateExamples,templatesByOrganizationId,templates,}from"api/queries/templates";
4+
import{
5+
templateExamples,
6+
templatesByOrganizationId,
7+
templates,
8+
}from"api/queries/templates";
59
import{useAuthenticated}from"contexts/auth/RequireAuth";
610
import{useDashboard}from"modules/dashboard/useDashboard";
711
import{pageTitle}from"utils/page";
@@ -12,13 +16,18 @@ export const TemplatesPage: FC = () => {
1216
const{ permissions}=useAuthenticated();
1317
const{ organizationId, experiments}=useDashboard();
1418

15-
consttemplatesByOrganizationIdQuery=useQuery(templatesByOrganizationId(organizationId));
19+
consttemplatesByOrganizationIdQuery=useQuery(
20+
templatesByOrganizationId(organizationId),
21+
);
1622
consttemplatesQuery=useQuery(templates());
1723
constexamplesQuery=useQuery({
1824
...templateExamples(organizationId),
1925
enabled:permissions.createTemplates,
2026
});
21-
consterror=templatesByOrganizationIdQuery.error||examplesQuery.error||templatesQuery.error;
27+
consterror=
28+
templatesByOrganizationIdQuery.error||
29+
examplesQuery.error||
30+
templatesQuery.error;
2231
constmultiOrgExperimentEnabled=experiments.includes("multi-organization");
2332

2433
return(
@@ -33,14 +42,14 @@ export const TemplatesPage: FC = () => {
3342
examples={examplesQuery.data}
3443
templates={templatesQuery.data}
3544
/>
36-
) :(
45+
) :(
3746
<TemplatesPageView
3847
error={error}
3948
canCreateTemplates={permissions.createTemplates}
4049
examples={examplesQuery.data}
4150
templates={templatesByOrganizationIdQuery.data}
4251
/>
43-
)}
52+
)}
4453
</>
4554
);
4655
};

‎site/src/pages/WorkspacesPage/WorkspacesPage.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ const WorkspacesPage: FC = () => {
4141
const{ permissions}=useAuthenticated();
4242
const{ entitlements, organizationId}=useDashboard();
4343

44-
consttemplatesQuery=useQuery(templatesByOrganizationId(organizationId,false));
44+
consttemplatesQuery=useQuery(
45+
templatesByOrganizationId(organizationId,false),
46+
);
4547

4648
constfilterProps=useWorkspacesFilter({
4749
searchParamsResult,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp