Skip to content

Commit

Permalink
fix: tiles file path
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-at-airwalk committed May 12, 2024
1 parent c428818 commit 85c4318
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/_components/Layouts/IndexTiles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ export default async function IndexTiles({
<TileCard
key={c?.frontmatter?.title}
name={c?.frontmatter?.title}
url={c?.file}
url={c?.file?.path}
isHero={c?.frontmatter?.hero}
image={
c?.frontmatter?.hero && c?.frontmatter?.image != null
? `/api/content/github/${initialContext.owner}/${initialContext.repo}?path=${path.dirname(c.file)}/${c.frontmatter.image}&branch=${initialContext.branch}`
? `/api/content/github/${initialContext.owner}/${initialContext.repo}?path=${path.dirname(c.file.path)}/${c.frontmatter.image}&branch=${initialContext.branch}`
: c?.frontmatter?.hero
? '/generic-solution.png'
: c?.frontmatter?.image
? `/api/content/github/${initialContext.owner}/${initialContext.repo}?path=${path.dirname(c.file)}/${c.frontmatter.image}&branch=${initialContext.branch}`
? `/api/content/github/${initialContext.owner}/${initialContext.repo}?path=${path.dirname(c.file.path)}/${c.frontmatter.image}&branch=${initialContext.branch}`
: undefined
}
/>
Expand Down
9 changes: 7 additions & 2 deletions src/_components/Layouts/lib/getTiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import matter from 'gray-matter';
import { getBranchSha, getDirStructure } from '@/lib/Github';
import { getLogger } from '@/lib/Logger';
import { cacheRead, cacheWrite } from '@/lib/Redis';
import type { ContentItem, FileContent, FrontMatter } from '@/lib/Types';
import type {
ContentItem,
FileContent,
FrontMatter,
GitHubFile,
} from '@/lib/Types';

const logger = getLogger().child({ module: 'getTiles' });

Expand All @@ -16,7 +21,7 @@ interface Tile {
image?: string;
[key: string]: any;
};
file: string;
file: GitHubFile;
[key: string]: any;
}

Expand Down

0 comments on commit 85c4318

Please sign in to comment.