Skip to content

Commit 18bcd4c

Browse files
committed
Update URL handling and paths, and refine GitHub link
Fixed the URL handling in `getSafeUrlWithToken` by removing the leading slash if present. Updated the function calls in `SolutionSection` and `home-page` components to use dynamic paths. Adjusted the GitHub link in `GitHubEditButton` to the correct directory. Took 15 minutes
1 parent 8a19127 commit 18bcd4c

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

app/dfda/components/SolutionSection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default function SolutionSection() {
1111

1212
const handleDigitalTwinSafeClick = async (path: string) => {
1313
setIsLoading(true)
14-
const url = await getSafeUrlWithToken('')
14+
const url = await getSafeUrlWithToken(path)
1515
window.open(url, '_blank')
1616
}
1717
const features = [

app/dfda/components/home-page.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default function HomePage() {
3232

3333
const handleDigitalTwinSafeClick = async (path: string) => {
3434
//setIsLoading(true)
35-
const url = await getSafeUrlWithToken('')
35+
const url = await getSafeUrlWithToken(path)
3636
window.open(url, '_blank')
3737
}
3838

@@ -67,7 +67,9 @@ export default function HomePage() {
6767
color: "bg-purple-400",
6868
icon: Pill,
6969
media: "https://user-images.githubusercontent.com/2808553/180306571-ac9cc741-6f34-4059-a814-6f8a72ed8322.png",
70-
onClick: handleDigitalTwinSafeClick
70+
onClick: () => {
71+
handleDigitalTwinSafeClick('intro')
72+
}
7173
},
7274
{
7375
title: "Clinipedia",

app/dfda/dfdaActions.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import {getServerSession} from 'next-auth/next'
1010

1111
export async function getSafeUrlWithToken(url: string) {
1212
if(!url.includes('https')) {
13+
//remove leading slash if it exists
14+
url = url.startsWith('/') ? url.slice(1) : url;
1315
url = 'https://safe.dfda.earth/app/public/#/app/' + url;
1416
}
1517
const token = await getDfdaAccessToken();

app/dfda/right-to-trial-act/components/GitHubEditButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { NeoBrutalistButton } from '@/components/ui/neo-brutalist-button'
55
export function GitHubEditButton() {
66
return (
77
<NeoBrutalistButton
8-
href="https://github.com/wishonia/wishonia/edit/main/content/globalSolutions/dfda/right-to-trial-act-1.md"
8+
href="https://github.com/wishonia/wishonia/edit/main/public/globalSolutions/dfda/right-to-trial-act-1.md"
99
external
1010
variant="secondary"
1111
className=""

0 commit comments

Comments
 (0)