Shorten code links in document view
This commit is contained in:
parent
357ef23bc7
commit
313611350c
2 changed files with 11 additions and 3 deletions
|
@ -6,6 +6,14 @@ import {
|
||||||
topics as topicList,
|
topics as topicList,
|
||||||
} from '@/app/db/data'
|
} from '@/app/db/data'
|
||||||
|
|
||||||
|
const getRepo = (link: string) => {
|
||||||
|
if (link.includes('github.com')) {
|
||||||
|
const owner = link.split('/')[3]
|
||||||
|
const name = link.split('/')[4]
|
||||||
|
return `git:${owner}/${name}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export const Code = ({
|
export const Code = ({
|
||||||
code,
|
code,
|
||||||
showTitle = true,
|
showTitle = true,
|
||||||
|
@ -20,7 +28,7 @@ export const Code = ({
|
||||||
{code.map((c: string, i) => (
|
{code.map((c: string, i) => (
|
||||||
<Fragment key={c}>
|
<Fragment key={c}>
|
||||||
<Link href={c} target='_blank'>
|
<Link href={c} target='_blank'>
|
||||||
{c}
|
{getRepo(c)}
|
||||||
</Link>
|
</Link>
|
||||||
{i !== code.length - 1 ? ', ' : null}
|
{i !== code.length - 1 ? ', ' : null}
|
||||||
</Fragment>
|
</Fragment>
|
||||||
|
|
|
@ -283,12 +283,12 @@ On Day 1 we will discuss the ins and outs of the robot. The Electrical Sub team
|
||||||
'eexiv-white-paper': {
|
'eexiv-white-paper': {
|
||||||
manifest: {
|
manifest: {
|
||||||
title: 'eeXiv Whitepaper',
|
title: 'eeXiv Whitepaper',
|
||||||
authors: ['ywu', 'avenkatesh'],
|
authors: ['avenkatesh', 'ywu'],
|
||||||
topics: ['eecs', 'frc'],
|
topics: ['eecs', 'frc'],
|
||||||
dates: [1707811359, 1707891311],
|
dates: [1707811359, 1707891311],
|
||||||
type: 'whitepaper',
|
type: 'whitepaper',
|
||||||
latest: 2,
|
latest: 2,
|
||||||
status: 'under review',
|
status: 'reviewed',
|
||||||
keywords: [
|
keywords: [
|
||||||
'eexiv',
|
'eexiv',
|
||||||
'whitepaper',
|
'whitepaper',
|
||||||
|
|
Loading…
Reference in a new issue