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,
|
||||
} 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 = ({
|
||||
code,
|
||||
showTitle = true,
|
||||
|
@ -20,7 +28,7 @@ export const Code = ({
|
|||
{code.map((c: string, i) => (
|
||||
<Fragment key={c}>
|
||||
<Link href={c} target='_blank'>
|
||||
{c}
|
||||
{getRepo(c)}
|
||||
</Link>
|
||||
{i !== code.length - 1 ? ', ' : null}
|
||||
</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': {
|
||||
manifest: {
|
||||
title: 'eeXiv Whitepaper',
|
||||
authors: ['ywu', 'avenkatesh'],
|
||||
authors: ['avenkatesh', 'ywu'],
|
||||
topics: ['eecs', 'frc'],
|
||||
dates: [1707811359, 1707891311],
|
||||
type: 'whitepaper',
|
||||
latest: 2,
|
||||
status: 'under review',
|
||||
status: 'reviewed',
|
||||
keywords: [
|
||||
'eexiv',
|
||||
'whitepaper',
|
||||
|
|
Loading…
Reference in a new issue