Remove some unneeded code

This commit is contained in:
Jack Kingsman
2026-01-26 20:22:19 -08:00
parent 22eb828b3c
commit 4382f4ab74
12 changed files with 19 additions and 178 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -13,8 +13,8 @@
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="manifest" href="/site.webmanifest" />
<script type="module" crossorigin src="/assets/index-sgUM1Nqn.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-BsZWFlnF.css">
<script type="module" crossorigin src="/assets/index-DsqXtGVx.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-Cxcg9Mr6.css">
</head>
<body>
<div id="root"></div>
-22
View File
@@ -93,16 +93,6 @@ export const api = {
// Contacts
getContacts: (limit = 100, offset = 0) =>
fetchJson<Contact[]>(`/contacts?limit=${limit}&offset=${offset}`),
getContact: (publicKey: string) => fetchJson<Contact>(`/contacts/${publicKey}`),
syncContacts: () => fetchJson<{ synced: number }>('/contacts/sync', { method: 'POST' }),
addContactToRadio: (publicKey: string) =>
fetchJson<{ status: string }>(`/contacts/${publicKey}/add-to-radio`, {
method: 'POST',
}),
removeContactFromRadio: (publicKey: string) =>
fetchJson<{ status: string }>(`/contacts/${publicKey}/remove-from-radio`, {
method: 'POST',
}),
deleteContact: (publicKey: string) =>
fetchJson<{ status: string }>(`/contacts/${publicKey}`, {
method: 'DELETE',
@@ -129,13 +119,11 @@ export const api = {
// Channels
getChannels: () => fetchJson<Channel[]>('/channels'),
getChannel: (key: string) => fetchJson<Channel>(`/channels/${key}`),
createChannel: (name: string, key?: string) =>
fetchJson<Channel>('/channels', {
method: 'POST',
body: JSON.stringify({ name, key }),
}),
syncChannels: () => fetchJson<{ synced: number }>('/channels/sync', { method: 'POST' }),
deleteChannel: (key: string) =>
fetchJson<{ status: string }>(`/channels/${key}`, { method: 'DELETE' }),
markChannelRead: (key: string) =>
@@ -215,16 +203,6 @@ export const api = {
}),
// Favorites
addFavorite: (type: Favorite['type'], id: string) =>
fetchJson<AppSettings>('/settings/favorites', {
method: 'POST',
body: JSON.stringify({ type, id }),
}),
removeFavorite: (type: Favorite['type'], id: string) =>
fetchJson<AppSettings>('/settings/favorites', {
method: 'DELETE',
body: JSON.stringify({ type, id }),
}),
toggleFavorite: (type: Favorite['type'], id: string) =>
fetchJson<AppSettings>('/settings/favorites/toggle', {
method: 'POST',
-50
View File
@@ -1,50 +0,0 @@
import * as React from 'react';
import { cva, type VariantProps } from 'class-variance-authority';
import { cn } from '@/lib/utils';
const alertVariants = cva(
'relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground',
{
variants: {
variant: {
default: 'bg-background text-foreground',
destructive:
'border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive',
warning: 'border-yellow-500/50 bg-yellow-500/10 text-yellow-200 [&>svg]:text-yellow-500',
},
},
defaultVariants: {
variant: 'default',
},
}
);
const Alert = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
>(({ className, variant, ...props }, ref) => (
<div ref={ref} role="alert" className={cn(alertVariants({ variant }), className)} {...props} />
));
Alert.displayName = 'Alert';
const AlertTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLHeadingElement>>(
({ className, ...props }, ref) => (
<h5
ref={ref}
className={cn('mb-1 font-medium leading-none tracking-tight', className)}
{...props}
/>
)
);
AlertTitle.displayName = 'AlertTitle';
const AlertDescription = React.forwardRef<
HTMLParagraphElement,
React.HTMLAttributes<HTMLParagraphElement>
>(({ className, ...props }, ref) => (
<div ref={ref} className={cn('text-sm [&_p]:leading-relaxed', className)} {...props} />
));
AlertDescription.displayName = 'AlertDescription';
export { Alert, AlertTitle, AlertDescription };
+1 -8
View File
@@ -1,11 +1,4 @@
export {
useRepeaterMode,
type UseRepeaterModeResult,
formatDuration,
formatTelemetry,
formatNeighbors,
formatAcl,
} from './useRepeaterMode';
export { useRepeaterMode, type UseRepeaterModeResult } from './useRepeaterMode';
export { useUnreadCounts, type UseUnreadCountsResult } from './useUnreadCounts';
export {
useConversationMessages,
-3
View File
@@ -6,9 +6,6 @@
/** 64-character hex string identifying a contact/node */
export type PublicKey = string;
/** 12-character hex prefix of a public key (used in message routing) */
export type PubkeyPrefix = string;
/** 32-character hex string identifying a channel */
export type ChannelKey = string;
+1 -37
View File
@@ -7,11 +7,8 @@
* module provides utilities for working with both formats consistently.
*/
/** Length of a full public key in hex characters */
export const PUBKEY_FULL_LENGTH = 64;
/** Length of a public key prefix in hex characters */
export const PUBKEY_PREFIX_LENGTH = 12;
const PUBKEY_PREFIX_LENGTH = 12;
/**
* Extract the 12-character prefix from a public key.
@@ -21,42 +18,9 @@ export function getPubkeyPrefix(key: string): string {
return key.slice(0, PUBKEY_PREFIX_LENGTH);
}
/**
* Check if two public keys match by comparing their prefixes.
* This handles the case where one key is full (64 chars) and
* the other is a prefix (12 chars).
*/
export function pubkeysMatch(a: string, b: string): boolean {
if (!a || !b) return false;
return getPubkeyPrefix(a) === getPubkeyPrefix(b);
}
/**
* Check if a public key starts with the given prefix.
* More explicit than using .startsWith() directly.
*/
export function pubkeyMatchesPrefix(fullKey: string, prefix: string): boolean {
if (!fullKey || !prefix) return false;
return fullKey.startsWith(prefix);
}
/**
* Get a display name for a contact, falling back to pubkey prefix.
*/
export function getContactDisplayName(name: string | null | undefined, pubkey: string): string {
return name || getPubkeyPrefix(pubkey);
}
/**
* Check if a key is a full 64-character public key.
*/
export function isFullPubkey(key: string): boolean {
return key.length === PUBKEY_FULL_LENGTH;
}
/**
* Check if a key is a 12-character prefix.
*/
export function isPubkeyPrefix(key: string): boolean {
return key.length === PUBKEY_PREFIX_LENGTH;
}