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

chore: reduce prominence of Scratch starter and emphasize Docker in UI#16665

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
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
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,7 +10,7 @@ import {
import { server } from "testHelpers/server";
import CreateTemplateGalleryPage from "./CreateTemplateGalleryPage";

test("does not display the scratch template", async () => {
test("displays the scratch template", async () => {
server.use(
http.get("api/v2/templates/examples", () => {
return HttpResponse.json([
Expand DownExpand Up@@ -49,5 +49,5 @@ test("does not display the scratch template", async () => {

await screen.findByText(MockTemplateExample.name);
screen.getByText(MockTemplateExample2.name);
expect(screen.queryByText("Scratch")).not.toBeInTheDocument();
expect(screen.queryByText("Scratch")).toBeInTheDocument();
});
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
import { templateExamples } from "api/queries/templates";
import type { TemplateExample } from "api/typesGenerated";
import type { FC } from "react";
import { Helmet } from "react-helmet-async";
import { useQuery } from "react-query";
Expand All@@ -10,8 +9,7 @@ import { CreateTemplateGalleryPageView } from "./CreateTemplateGalleryPageView";
const CreateTemplatesGalleryPage: FC = () => {
const templateExamplesQuery = useQuery(templateExamples());
const starterTemplatesByTag = templateExamplesQuery.data
? // Currently, the scratch template should not be displayed on the starter templates page.
getTemplatesByTag(removeScratchExample(templateExamplesQuery.data))
? getTemplatesByTag(templateExamplesQuery.data)
: undefined;

return (
Expand All@@ -27,8 +25,4 @@ const CreateTemplatesGalleryPage: FC = () => {
);
};

const removeScratchExample = (data: TemplateExample[]) => {
return data.filter((example) => example.id !== "scratch");
};

export default CreateTemplatesGalleryPage;
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,34 +41,6 @@ export const CreateTemplateGalleryPageView: FC<
height: "max-content",
}}
>
<Card variant="outlined" css={{ width: 320, borderRadius: 6 }}>
<CardActionArea
component={RouterLink}
to="/templates/new?exampleId=scratch"
sx={{ height: 115, padding: 1 }}
>
<CardContent>
<Stack
direction="row"
spacing={3}
css={{ alignItems: "center" }}
>
<div css={styles.icon}>
<ExternalImage
src="/emojis/1f4c4.png"
css={{ width: "100%", height: "100%" }}
/>
</div>
<div>
<h4 css={styles.cardTitle}>Scratch Template</h4>
<span css={styles.cardDescription}>
Create a minimal starter template that you can customize
</span>
</div>
</Stack>
</CardContent>
</CardActionArea>
</Card>
<Card variant="outlined" css={{ width: 320, borderRadius: 6 }}>
<CardActionArea
component={RouterLink}
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
importtype{Interpolation,Theme}from"@emotion/react";
importtype{TemplateExample}from"api/typesGenerated";
import{Stack}from"components/Stack/Stack";
import{TemplateExampleCard}from"modules/templates/TemplateExampleCard/TemplateExampleCard";
importtype{FC}from"react";
Expand All@@ -21,6 +22,21 @@ const selectTags = (starterTemplatesByTag: StarterTemplatesByTag) => {
:undefined;
};

constsortVisibleTemplates=(templates:TemplateExample[])=>{
// The docker template should be the first template in the list,
// as it's the easiest way to get started with Coder.
constdockerTemplateId="docker";
returntemplates.sort((a,b)=>{
if(a.id===dockerTemplateId){
return-1;
}
if(b.id===dockerTemplateId){
return1;
}
returna.name.localeCompare(b.name);
});
};

exportinterfaceStarterTemplatesProps{
starterTemplatesByTag?:StarterTemplatesByTag;
}
Expand All@@ -34,7 +50,7 @@ export const StarterTemplates: FC<StarterTemplatesProps> = ({
:undefined;
constactiveTag=urlParams.get("tag")??"all";
constvisibleTemplates=starterTemplatesByTag
?starterTemplatesByTag[activeTag]
?sortVisibleTemplates(starterTemplatesByTag[activeTag])
:undefined;

return(
Expand Down
8 changes: 0 additions & 8 deletionssite/src/pages/TemplatesPage/CreateTemplateButton.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,14 +26,6 @@ export const CreateTemplateButton: FC<CreateTemplateButtonProps> = ({
</Button>
</MoreMenuTrigger>
<MoreMenuContent>
<MoreMenuItem
onClick={() => {
onNavigate("/templates/new?exampleId=scratch");
}}
>
<NoteAddOutlined />
From scratch
</MoreMenuItem>
<MoreMenuItem
onClick={() => {
onNavigate("/templates/new");
Expand Down
42 changes: 0 additions & 42 deletionssite/src/pages/TemplatesPage/TemplatesPage.test.tsx
View file
Open in desktop

This file was deleted.

Loading

[8]ページ先頭

©2009-2025 Movatter.jp