Skip to content

Commit 4b5d696

Browse files
Jack Pettitclaude
authored andcommitted
Bump TinaCMS to aceecd8 canary + visual-editing wiring
- data.ts: mark getPage/getBlog with priority: 'primary' so the admin auto-selects the page form on entry (no manual file-tree click). - Header.astro / Footer.astro: move data-tina-field off the array container and onto each nav link + contact icon so clicks open the specific list item instead of the empty array root. - IconLink.astro: accept HTMLAttributes<'a'> + spread, owns nullish defaults internally so callers can pass raw config values. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 0c514eb commit 4b5d696

5 files changed

Lines changed: 48 additions & 21 deletions

File tree

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
"@astrojs/rss": "^4.0.15",
1616
"@astrojs/sitemap": "^3.7.0",
1717
"@astrojs/vercel": "^9.0.5",
18-
"@tinacms/astro": "0.0.0-afd3b10-20260512095118",
18+
"@tinacms/astro": "0.0.0-aceecd8-20260513074647",
1919
"astro": "^5.16.0"
2020
},
2121
"devDependencies": {
22-
"@tinacms/cli": "0.0.0-afd3b10-20260512095118",
22+
"@tinacms/cli": "0.0.0-aceecd8-20260513074647",
2323
"@types/node": "^25.1.0",
24-
"tinacms": "0.0.0-afd3b10-20260512095118"
24+
"tinacms": "0.0.0-aceecd8-20260513074647"
2525
}
2626
}

src/components/Footer.astro

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,15 @@ const today = new Date();
1919
<footer class="copyright-footer">
2020
&copy; {today.getFullYear()}
2121
<span data-tina-field={seo ? tinaField(seo, "siteOwner") : undefined}>{seo?.siteOwner}</span>. All rights reserved.
22-
<div class="social-links" data-tina-field={config ? tinaField(config, "contactLinks") : undefined}>
23-
{contactLinks.map((link) => <IconLink title={link.title ?? ""} link={link.link ?? "#"} icon={link.icon ?? ""} />)}
22+
<div class="social-links">
23+
{contactLinks.map((link) => (
24+
<IconLink
25+
title={link.title}
26+
link={link.link}
27+
icon={link.icon}
28+
data-tina-field={tinaField(link, "title")}
29+
/>
30+
))}
2431
</div>
2532
</footer>
2633

src/components/Header.astro

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,20 @@ const contactLinks = (config?.contactLinks ?? []).filter((item) => item !== null
2222
<span data-tina-field={seo ? tinaField(seo, "title") : undefined}>{seo?.title}</span>
2323
</a>
2424
</h2>
25-
<div class="internal-links" data-tina-field={config ? tinaField(config, "nav") : undefined}>
26-
{nav.map((item) => <HeaderLink href={item.link}>{item.title}</HeaderLink>)}
25+
<div class="internal-links">
26+
{nav.map((item) => (
27+
<HeaderLink href={item.link} data-tina-field={tinaField(item, "title")}>{item.title}</HeaderLink>
28+
))}
2729
</div>
28-
<div class="social-links" data-tina-field={config ? tinaField(config, "contactLinks") : undefined}>
29-
{contactLinks.map((link) => <IconLink title={link.title ?? ""} link={link.link ?? "#"} icon={link.icon ?? ""} />)}
30+
<div class="social-links">
31+
{contactLinks.map((link) => (
32+
<IconLink
33+
title={link.title}
34+
link={link.link}
35+
icon={link.icon}
36+
data-tina-field={tinaField(link, "title")}
37+
/>
38+
))}
3039
</div>
3140
</nav>
3241
</header>

src/components/IconLink.astro

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,34 @@
11
---
2-
type Props = {
3-
title: string;
4-
link: string;
5-
icon: string;
2+
import type { HTMLAttributes } from 'astro/types';
3+
4+
type Props = HTMLAttributes<'a'> & {
5+
title?: string | null;
6+
link?: string | null;
7+
icon?: string | null;
68
};
79
8-
const { title, link, icon } = Astro.props;
10+
const { title, link, icon, ...rest } = Astro.props;
11+
const safeTitle = title ?? "";
12+
const safeLink = link ?? "#";
13+
const safeIcon = icon ?? "";
914
---
1015

11-
<a href={link} target="_blank" aria-label={`Go to ${title}`}>
12-
<span class="sr-only">{title}</span>
13-
{icon === "TbBrandX" && (
16+
<a href={safeLink} target="_blank" aria-label={`Go to ${safeTitle}`} {...rest}>
17+
<span class="sr-only">{safeTitle}</span>
18+
{safeIcon === "TbBrandX" && (
1419
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
1520
<path d="M4 4l11.733 16h4.267l-11.733 -16z"></path>
1621
<path d="M4 20l6.768 -6.768m2.46 -2.46l6.772 -6.772"></path>
1722
</svg>
1823
)}
19-
{icon === "TbBook2" && (
24+
{safeIcon === "TbBook2" && (
2025
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
2126
<path d="M19 4v16h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h12z"></path>
2227
<path d="M19 16h-12a2 2 0 0 0 -2 2"></path>
2328
<path d="M9 8h6"></path>
2429
</svg>
2530
)}
26-
{icon === "TbBrandGithub" && (
31+
{safeIcon === "TbBrandGithub" && (
2732
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
2833
<path d="M9 19c-4.3 1.4 -4.3 -2.5 -6 -3m12 5v-3.5c0 -1 .1 -1.4 -.5 -2c2.8 -.3 5.5 -1.4 5.5 -6a4.6 4.6 0 0 0 -1.3 -3.2a4.2 4.2 0 0 0 -.1 -3.2s-1.1 -.3 -3.5 1.3a12.3 12.3 0 0 0 -6.2 0c-2.4 -1.6 -3.5 -1.3 -3.5 -1.3a4.2 4.2 0 0 0 -.1 3.2a4.6 4.6 0 0 0 -1.3 3.2c0 4.6 2.7 5.7 5.5 6c-.6 .6 -.6 1.2 -.5 2v3.5"></path>
2934
</svg>

src/lib/data.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,16 @@ export const getConfig = () =>
1111
requestWithMetadata(client.queries.config({ relativePath: 'config.json' }));
1212

1313
export const getPage = (slug: string) =>
14-
requestWithMetadata(client.queries.page({ relativePath: `${slug}.mdx` }));
14+
requestWithMetadata(
15+
client.queries.page({ relativePath: `${slug}.mdx` }),
16+
{ priority: 'primary' },
17+
);
1518

1619
export const getBlog = (slug: string) =>
17-
requestWithMetadata(client.queries.blog({ relativePath: `${slug}.mdx` }));
20+
requestWithMetadata(
21+
client.queries.blog({ relativePath: `${slug}.mdx` }),
22+
{ priority: 'primary' },
23+
);
1824

1925
export async function listPages() {
2026
const result = await client.queries.pageConnection();

0 commit comments

Comments
 (0)