mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-23 19:05:16 +02:00
Merge remote-tracking branch 'upstream/dev' into feat/ui-revamp
This commit is contained in:
commit
87caa4b6d0
29 changed files with 1622 additions and 891 deletions
|
|
@ -7,19 +7,11 @@ import { openSafeNavigationHref, sanitizeHref } from "../shared/media";
|
|||
import { cn } from "./_adapter";
|
||||
import { CitationHoverPopover } from "./citation-hover-popover";
|
||||
import type { CitationVariant, SerializableCitation } from "./schema";
|
||||
import { tryGetHostname } from "@/lib/url";
|
||||
import { TYPE_ICONS } from "./type-icons";
|
||||
|
||||
const FALLBACK_LOCALE = "en-US";
|
||||
|
||||
function extractDomain(url: string): string | undefined {
|
||||
try {
|
||||
const urlObj = new URL(url);
|
||||
return urlObj.hostname.replace(/^www\./, "");
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
function formatDate(isoString: string, locale: string): string {
|
||||
try {
|
||||
const date = new Date(isoString);
|
||||
|
|
@ -56,7 +48,7 @@ export function Citation(props: CitationProps) {
|
|||
|
||||
const locale = providedLocale ?? FALLBACK_LOCALE;
|
||||
const sanitizedHref = sanitizeHref(rawHref);
|
||||
const domain = providedDomain ?? extractDomain(rawHref);
|
||||
const domain = providedDomain ?? tryGetHostname(rawHref);
|
||||
|
||||
const citationData: SerializableCitation = {
|
||||
...serializable,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue