Skip to content

Commit

Permalink
fix: template info
Browse files Browse the repository at this point in the history
  • Loading branch information
qinluhe committed Oct 25, 2024
1 parent 7dabd54 commit 12edacc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions components/template-center/template-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ function TemplateItem({ template, category }: { template: TemplateSummary; categ
const newURL = new URL(origin);
const publishInfo = template.publish_info;

if (!publishInfo) {
url.searchParams.set('theme', 'light');
url.searchParams.set('template', 'true');
url.searchParams.set('thumbnail', 'true');
return url.toString();
}

newURL.pathname = `/${publishInfo.namespace}/${publishInfo.publish_name}`;

newURL.searchParams.set('theme', 'light');
Expand Down
4 changes: 4 additions & 0 deletions components/template-center/template/template-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ function TemplateSection({ template, categoryName }: { template: Template; categ
const newURL = new URL(origin);
const publishInfo = template.publish_info;

if (!publishInfo) {
return url.toString();
}

newURL.pathname = `/${publishInfo.namespace}/${publishInfo.publish_name}`;
return newURL.toString();
}, [template.publish_info, template.view_url]);
Expand Down

0 comments on commit 12edacc

Please sign in to comment.