8000 feat(site): add create template from scratch by BrunoQuaresma · Pull Request #12082 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

feat(site): add create template from scratch #12082

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Feb 9, 2024
Prev Previous commit
Next Next commit
Don't show scratch template
  • Loading branch information
BrunoQuaresma committed Feb 9, 2024
commit cdb36a82a5fa11e11c94b4e070ca04019ba96420
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import { useOrganizationId } from "contexts/auth/useOrganizationId";
import { pageTitle } from "utils/page";
import { getTemplatesByTag } from "utils/starterTemplates";
import { StarterTemplatesPageView } from "./StarterTemplatesPageView";
import { TemplateExample } from "api/typesGenerated";

const StarterTemplatesPage: FC = () => {
const organizationId = useOrganizationId();
const templateExamplesQuery = useQuery(templateExamples(organizationId));
const starterTemplatesByTag = templateExamplesQuery.data
? getTemplatesByTag(templateExamplesQuery.data)
? // Currently, the scratch template should not be displayed on the starter templates page.
getTemplatesByTag(removeScratchExample(templateExamplesQuery.data))
: undefined;

return (
Expand All @@ -28,4 +30,8 @@ const StarterTemplatesPage: FC = () => {
);
};

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

export default StarterTemplatesPage;
0