Skip to content

Commit 9c3c595

Browse files
committed
trying to fix typescript issues with permalinks
1 parent b0a4946 commit 9c3c595

File tree

5 files changed

+24
-23
lines changed

5 files changed

+24
-23
lines changed

astro.config.mjs

-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ export default defineConfig({
3232

3333
output: 'static',
3434

35-
site: 'https://github.com/a3d3-institute/hdr2024.github.io',
36-
3735
integrations: [
3836
tailwind({
3937
applyBaseStyles: false,

node_modules/.vite/deps/_metadata.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/widgets/Footer.astro

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export interface Props {
2525
theme?: string;
2626
}
2727
28-
const { socialLinks = [], theme = 'dark' } = Astro.props;
28+
const { socialLinks = [], links = [], secondaryLinks = [], theme = 'dark' } = Astro.props;
2929
---
3030
<footer class:list={[{ dark: theme === 'dark' }, 'fixed bottom-0 left-0 z-20 w-full p-4 bg-no-repeat bg-transparent md:flex md:items-center md:justify-between md:p-6 dark:bg-transparent']}>
3131
<span class="text-sm text-gray-500 sm:text-left dark:text-gray-400">Supported by award XXXX from the National Science Foundation. Hosted by the A3D3 Institute and the Illinois HEP Group</span>

src/navigation.js

+2
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,7 @@ export const footerData = {
6767
socialLinks: [
6868
{ ariaLabel: 'Github', icon: 'tabler:brand-github', href: 'https://github.com/a3d3-institute/hdr2024.github.io'},
6969
],
70+
links: [],
71+
secondaryLinks: [],
7072
theme: 'dark'
7173
};

src/utils/permalinks.ts

+18-17
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const getCanonical = (path = ''): string | URL => {
4141
/** */
4242
export const getPermalink = (slug = '', type = 'page'): string => {
4343
let permalink: string;
44-
44+
4545
if (
4646
slug.startsWith('https://') ||
4747
slug.startsWith('http://') ||
@@ -104,28 +104,29 @@ export const getAsset = (path: string): string =>
104104
const definitivePermalink = (permalink: string): string => createPath(BASE_PATHNAME, permalink);
105105

106106
/** */
107-
export const applyGetPermalinks = (menu: object = {}) => {
107+
export const applyGetPermalinks = (menu: object = {}): { [key: string]: any } => {
108108
if (Array.isArray(menu)) {
109109
return menu.map((item) => applyGetPermalinks(item));
110110
} else if (typeof menu === 'object' && menu !== null) {
111-
const obj = {};
111+
const obj: { [key: string]: any } = {};
112112
for (const key in menu) {
113113
if (key === 'href') {
114-
if (typeof menu[key] === 'string') {
115-
obj[key] = getPermalink(menu[key]);
116-
} else if (typeof menu[key] === 'object') {
117-
if (menu[key].type === 'home') {
118-
obj[key] = getHomePermalink();
119-
} else if (menu[key].type === 'blog') {
120-
obj[key] = getBlogPermalink();
121-
} else if (menu[key].type === 'asset') {
122-
obj[key] = getAsset(menu[key].url);
123-
} else if (menu[key].url) {
124-
obj[key] = getPermalink(menu[key].url, menu[key].type);
125-
}
126-
}
114+
if (typeof menu[key as keyof typeof menu] === 'string') {
115+
obj[key] = getPermalink(menu[key as keyof typeof menu]);
116+
}
117+
// else if (typeof menu[key as keyof typeof menu] === 'object') {
118+
// if (menu[key].type === 'home') {
119+
// obj[key] = getHomePermalink();
120+
// } else if (menu[key].type === 'blog') {
121+
// obj[key] = getBlogPermalink();
122+
// } else if (menu[key].type === 'asset') {
123+
// obj[key] = getAsset(menu[key].url);
124+
// } else if (menu[key].url) {
125+
// obj[key] = getPermalink(menu[key].url, menu[key].type);
126+
// }
127+
// }
127128
} else {
128-
obj[key] = applyGetPermalinks(menu[key]);
129+
obj[key] = applyGetPermalinks(menu[key as keyof typeof menu]);
129130
}
130131
}
131132
return obj;

0 commit comments

Comments
 (0)