File tree Expand file tree Collapse file tree 4 files changed +24
-5
lines changed Expand file tree Collapse file tree 4 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -15,9 +15,7 @@ import type { IRawThemeSetting } from "shiki/textmate";
1515import chroma from "chroma-js" ;
1616import { getEffectiveGlobalTheme } from "$lib/theme.svelte" ;
1717import { onDestroy } from "svelte" ;
18-
19- export const DEFAULT_THEME_LIGHT : BundledTheme = "github-light-default" ;
20- export const DEFAULT_THEME_DARK : BundledTheme = "github-dark-default" ;
18+ import { DEFAULT_THEME_LIGHT } from "$lib/global-options.svelte" ;
2119
2220export type DiffViewerPatch = {
2321 hunks : DiffViewerPatchHunk [ ] ;
Original file line number Diff line number Diff line change 1- import { DEFAULT_THEME_DARK , DEFAULT_THEME_LIGHT } from "$lib/components/diff/concise-diff-view.svelte" ;
21import type { BundledTheme } from "shiki" ;
32import { browser } from "$app/environment" ;
43import { getEffectiveGlobalTheme } from "$lib/theme.svelte" ;
54import { watchLocalStorage } from "$lib/util" ;
65import { Context } from "runed" ;
76
7+ export const DEFAULT_THEME_LIGHT : BundledTheme = "github-light-default" ;
8+ export const DEFAULT_THEME_DARK : BundledTheme = "github-dark-default" ;
9+
810export type SidebarLocation = "left" | "right" ;
911
1012export class GlobalOptions {
Original file line number Diff line number Diff line change 1515 <span class =" iconify size-6 shrink-0 octicon--mark-github-24" ></span >
1616 <h1 class ="text-base" >{details .owner }<span class ="mx-1.5 font-light text-em-med" >/</span >{details .repo }</h1 >
1717 </div >
18- <h2 class ="text-sm text-em-med" ><a href ={details .backlink } target ="_blank" class ="hover:text-primary" >{details .description }</a ></h2 >
18+ <h2 class =" text-sm text-em-med" >
19+ <a href ={details .backlink } target ="_blank" rel ="noopener noreferrer" class ="hover:text-primary" >{details .description }</a >
20+ </h2 >
1921 </div >
2022{/ snippet }
2123
Original file line number Diff line number Diff line change 3131 }
3232
3333 let patchHeaderDiffOnly = $derived (value .type === " text" && value .patchHeaderDiffOnly );
34+
35+ let { baseFileUrl, headFileUrl } = $derived .by (() => {
36+ if (viewer .diffMetadata ?.type === " github" ) {
37+ const ghDetails = viewer .diffMetadata .details ;
38+ return {
39+ baseFileUrl: ` https://github.com/${ghDetails .owner }/${ghDetails .repo }/blob/${ghDetails .base }/${value .fromFile } ` ,
40+ headFileUrl: ` https://github.com/${ghDetails .owner }/${ghDetails .repo }/blob/${ghDetails .head }/${value .toFile } ` ,
41+ };
42+ }
43+ return { baseFileUrl: undefined , headFileUrl: undefined };
44+ });
3445 </script >
3546
3647{#snippet fileName ()}
8596 }
8697 }
8798 />
99+ {#if baseFileUrl }
100+ <Button .Root href ={baseFileUrl } target =" _blank" rel =" noopener noreferrer" class =" btn-ghost px-2 py-1" >View file at base</Button .Root >
101+ {/if }
102+ {#if headFileUrl }
103+ <Button .Root href ={headFileUrl } target =" _blank" rel =" noopener noreferrer" class =" btn-ghost px-2 py-1" >View file at head</Button .Root >
104+ {/if }
88105 <Popover .Arrow class =" text-edge" />
89106 </Popover .Content >
90107 </Popover .Portal >
You can’t perform that action at this time.
0 commit comments