Overview
Create utility to extract domain from story URLs.
Parent Epic: #70
Priority: P2
Prerequisites
Next Issues (after this is complete)
- Can be used by Story component
Acceptance Criteria
Implementation Notes
export function extractDomain(url: string | null | undefined): string | null {
if (!url) return null;
try {
const parsed = new URL(url);
return parsed.hostname.replace(/^www\./, '');
} catch {
return null;
}
}
// Examples:
// "https://www.example.com/path" -> "example.com"
// "http://github.com/user/repo" -> "github.com"
// null -> null
// "not a url" -> null
Note: This could also be done server-side in the Story presenter.
Overview
Create utility to extract domain from story URLs.
Parent Epic: #70
Priority: P2
Prerequisites
Next Issues (after this is complete)
Acceptance Criteria
app/javascript/lib/urlUtils.tscreatedImplementation Notes
Note: This could also be done server-side in the Story presenter.