this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

✨ Add /o link on works

+70 -30
+42
src/components/LocalFileLink.astro
··· 1 + --- 2 + type Props = { 3 + href: string; 4 + title: string; 5 + text: string; 6 + keybind?: string; 7 + }; 8 + 9 + const { href, title, text, keybind } = Astro.props; 10 + --- 11 + 12 + <script> 13 + document.querySelectorAll("a[data-keybind]").forEach((el) => { 14 + window.addEventListener("keypress", (e) => { 15 + if (!(el instanceof HTMLAnchorElement)) return; 16 + if (e.key === el.dataset.keybind) { 17 + window.location.href = el.href; 18 + } 19 + }); 20 + }); 21 + </script> 22 + 23 + <a 24 + data-keybind={keybind} 25 + class="edit-button" 26 + href={`vscode://file/${href.replace("/home/uwun/", "C:/Users/ewen/").replace("~/", "C:/Users/ewen/")}`} 27 + title={title} 28 + > 29 + {text} 30 + </a> 31 + 32 + <style> 33 + a.edit-button { 34 + color: transparent; 35 + margin-left: 1em; 36 + text-decoration: none; 37 + } 38 + 39 + a.edit-button:hover { 40 + color: var(--primary, black); 41 + } 42 + </style>
+18 -29
src/components/StrongHeader.astro
··· 1 1 --- 2 + import LocalFileLink from "./LocalFileLink.astro"; 2 3 import Translated from "./Translated.astro"; 3 4 import WIPIndicator from "./WIPIndicator.astro"; 4 5 5 6 type Props = { 6 7 back?: string; 7 8 editButton?: string; 9 + editFolderButton?: string; 8 10 } & ( 9 11 | { title: string; wip?: undefined } 10 12 | { title: { fr: string; en: string }; wip?: boolean } ··· 22 24 } 23 25 ); 24 26 25 - const { title, wip, back, editButton } = Astro.props; 27 + const { title, wip, back, editButton, editFolderButton } = Astro.props; 26 28 --- 27 29 28 - <script> 29 - if (document.querySelector("#edit")) { 30 - window.addEventListener("keypress", (e) => { 31 - if (e.key === "e") { 32 - window.location.href = document.querySelector("#edit").href; 33 - } 34 - }); 35 - } 36 - </script> 30 + <script></script> 37 31 38 32 <header> 39 33 { ··· 45 39 </a> 46 40 )} 47 41 {editButton && ( 48 - <a 49 - id="edit" 50 - class="edit-button" 51 - href={`vscode://file/${editButton.replace("/home/uwun/", "C:/Users/ewen/").replace("~/", "C:/Users/ewen/")}`} 42 + <LocalFileLink 43 + keybind="e" 44 + href={editButton} 52 45 title="edit (if you're me only :3)" 53 - > 54 - /ed 55 - </a> 46 + text="/ed" 47 + /> 48 + )} 49 + {editFolderButton && ( 50 + <LocalFileLink 51 + keybind="o" 52 + href={editFolderButton} 53 + title="open folder (if you're me only :3)" 54 + text="/o" 55 + /> 56 56 )} 57 57 </section> 58 58 ) ··· 103 103 object-position: 0 0; 104 104 } 105 105 106 - a.back, 107 - a.edit-button { 108 - z-index: 2; 106 + a.back { 109 107 text-decoration: none; 110 108 } 111 109 112 110 section.links a:not(:last-child)::before { 113 111 margin-left: 0.5em; 114 - } 115 - 116 - a.edit-button { 117 - color: transparent; 118 - margin-left: 1em; 119 - } 120 - 121 - a.edit-button:hover { 122 - color: var(--primary, black); 123 112 } 124 113 </style>
+10 -1
src/pages/works/[work].astro
··· 83 83 .join(" "); 84 84 85 85 const firstMediaBlock = blocks.find((b) => b.type === "media"); 86 + 87 + const folderPath = entry.data.source 88 + .split("\\") 89 + .slice(0, -2) 90 + .join("\\"); 86 91 --- 87 92 88 93 <Layout colors={colors}> 89 94 <StrongHeader 90 95 back="/" 91 96 editButton={entry.data.source} 97 + editFolderButton={folderPath} 92 98 title={titleStyle === "image" && firstMediaBlock 93 99 ? { img: imageAttrs(firstMediaBlock) } 94 - : { fr: content.fr?.title, en: content.en?.title }} 100 + : { 101 + fr: content.fr?.title ?? content.default?.title, 102 + en: content.en?.title ?? content.default?.title, 103 + }} 95 104 wip={wip} 96 105 > 97 106 <section class="tags">