Skip to content

Commit 9327606

Browse files
Copilotbenfoxall
andcommitted
Address code review feedback
Co-authored-by: benfoxall <51385+benfoxall@users.noreply.github.com>
1 parent 22490f3 commit 9327606

File tree

2 files changed

+26
-13
lines changed

2 files changed

+26
-13
lines changed

_sass/_style.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
--background-light: #e6e7e8;
66
--foreground: #000;
77
--foreground-light: #fff;
8+
--foreground-muted: #666;
89
--link: blue;
910
--filter: invert(0);
1011
}
@@ -112,7 +113,7 @@ ol {
112113
display: block;
113114
min-height: 1.5em;
114115
font-size: 1rem;
115-
color: #666;
116+
color: var(--foreground-muted);
116117
font-style: italic;
117118
margin-top: 0.25em;
118119
opacity: 0;

assets/prompt-api-summaries.js

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
(function() {
1212
'use strict';
1313

14+
// Default prompt for generating summaries
15+
const DEFAULT_PROMPT = 'Write a short, witty one-sentence summary of this hack day (max 10 words):';
16+
1417
// Store parsed feed items for reuse
1518
let feedItems = null;
1619
// Store the language model session
@@ -126,18 +129,27 @@ Don't use emojis. Don't start with "A" or "The".`
126129
* @returns {HTMLElement|null}
127130
*/
128131
function findTaglineElement(url) {
129-
// Extract the path from the URL (e.g., "/hacks/50/" from "https://remotehack.space/hacks/50/")
130-
const urlPath = new URL(url).pathname;
131-
132-
// Find the link that matches this path
133-
const links = document.querySelectorAll('.past-events a');
134-
for (const link of links) {
135-
const linkPath = new URL(link.href).pathname;
136-
if (linkPath === urlPath) {
137-
// Find the tagline element within the same list item
138-
const li = link.closest('li');
139-
return li?.querySelector('.hack-tagline');
132+
// Validate URL before processing
133+
if (!url || typeof url !== 'string') {
134+
return null;
135+
}
136+
137+
try {
138+
// Extract the path from the URL (e.g., "/hacks/50/" from "https://remotehack.space/hacks/50/")
139+
const urlPath = new URL(url).pathname;
140+
141+
// Find the link that matches this path
142+
const links = document.querySelectorAll('.past-events a');
143+
for (const link of links) {
144+
const linkPath = new URL(link.href).pathname;
145+
if (linkPath === urlPath) {
146+
// Find the tagline element within the same list item
147+
const li = link.closest('li');
148+
return li?.querySelector('.hack-tagline');
149+
}
140150
}
151+
} catch (error) {
152+
console.warn('[Prompt API] Invalid URL in feed item:', url);
141153
}
142154
return null;
143155
}
@@ -177,7 +189,7 @@ Content: ${item.description}`;
177189
* Update all taglines on the page with generated summaries
178190
* @param {string} prompt - The prompt to use for generation
179191
*/
180-
async function updateTaglines(prompt = 'Write a short, witty one-sentence summary of this hack day (max 10 words):') {
192+
async function updateTaglines(prompt = DEFAULT_PROMPT) {
181193
const available = await isPromptAPIAvailable();
182194
if (!available) {
183195
console.info('[Prompt API] Skipping tagline updates - API not available');

0 commit comments

Comments
 (0)