diff options
Diffstat (limited to 'src/lib/strings')
-rw-r--r-- | src/lib/strings/display-names.ts | 15 | ||||
-rw-r--r-- | src/lib/strings/headings.ts | 4 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/lib/strings/display-names.ts b/src/lib/strings/display-names.ts index 555151b55..b98153732 100644 --- a/src/lib/strings/display-names.ts +++ b/src/lib/strings/display-names.ts @@ -10,3 +10,18 @@ export function sanitizeDisplayName(str: string): string { } return '' } + +export function combinedDisplayName({ + handle, + displayName, +}: { + handle?: string + displayName?: string +}): string { + if (!handle) { + return '' + } + return displayName + ? `${sanitizeDisplayName(displayName)} (@${handle})` + : `@${handle}` +} diff --git a/src/lib/strings/headings.ts b/src/lib/strings/headings.ts new file mode 100644 index 000000000..a88a69645 --- /dev/null +++ b/src/lib/strings/headings.ts @@ -0,0 +1,4 @@ +export function bskyTitle(page: string, unreadCountLabel?: string) { + const unreadPrefix = unreadCountLabel ? `(${unreadCountLabel}) ` : '' + return `${unreadPrefix}${page} - Bluesky` +} |