Skip to content

Commit

Permalink
feat: templates logo url (#315)
Browse files Browse the repository at this point in the history
  • Loading branch information
baktun14 authored Aug 16, 2024
1 parent 7c2263b commit fd92d15
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 6 additions & 3 deletions apps/api/src/services/external/templateReposService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type Template = {
guide?: string;
githubUrl?: string;
persistentStorageEnabled?: boolean;
config?: { ssh?: boolean };
config?: { ssh?: boolean; logoUrl?: string };
};

type TemplateSource = {
Expand Down Expand Up @@ -443,13 +443,14 @@ export async function fetchTemplatesInfo(octokit: Octokit, categories: Category[
const deploy = await findFileContentAsync(["deploy.yaml", "deploy.yml"], response.data);
const guide = await findFileContentAsync("GUIDE.md", response.data);
const config = await findFileContentAsync("config.json", response.data);
const _config = config ? JSON.parse(config) : { ssh: false, logoUrl: "" };

const template: Template = {
name: templateSource.name,
path: templateSource.path,
logoUrl: templateSource.logoUrl,
summary: templateSource.summary,
config: config ? JSON.parse(config) : { ssh: false }
config: _config
};

template.readme = readme && replaceLinks(readme, templateSource.repoOwner, templateSource.repoName, templateSource.repoVersion, templateSource.path);
Expand All @@ -459,7 +460,9 @@ export async function fetchTemplatesInfo(octokit: Octokit, categories: Category[
template.githubUrl = `https://github.com/${templateSource.repoOwner}/${templateSource.repoName}/blob/${templateSource.repoVersion}/${templateSource.path}`;

if (!template.logoUrl) {
template.logoUrl = getLogoFromPath(template.path);
const logoFromPath = getLogoFromPath(template.path);
const configLogo = _config?.logoUrl || "";
template.logoUrl = logoFromPath || configLogo;
}

if (!template.summary) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";
import React, { useEffect, useState } from "react";
import { Button, buttonVariants } from "@akashnetwork/ui/components";
import { ArrowRight, Cpu, Page, Rocket, Wrench } from "iconoir-react";
import { ArrowRight, Cpu, Page, Rocket, Wrench, Linux } from "iconoir-react";
import { NavArrowLeft } from "iconoir-react";
import { useAtom } from "jotai";
import Link from "next/link";
Expand Down Expand Up @@ -97,9 +97,9 @@ export const TemplateList: React.FunctionComponent = () => {

{
<DeployOptionBox
title="Plain Linux"
title="Linux"
description="Choose from multiple linux distros. Deploy and SSH into it. Install and run what you want after."
icon={<Page />}
icon={<Linux />}
onClick={() => onSDLBuilderClick("deploy-linux")}
testId="plain-linux-card"
/>
Expand Down

0 comments on commit fd92d15

Please sign in to comment.