Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
chore: cleanup ui remote access setting
Faisal Amir94d86c06e007
diff --git a/web-app/src/containers/ChannelCard.tsx b/web-app/src/containers/ChannelCard.tsxindex 6762b1be2..5d33e032b 100644--- a/web-app/src/containers/ChannelCard.tsx+++ b/web-app/src/containers/ChannelCard.tsx@@ -7,6 +7,7 @@ import {IconSettings,IconTrash,} from '@tabler/icons-react'+import { cn } from '@/lib/utils'export type ChannelType = 'telegram' | 'whatsapp' | 'discord'@@ -46,6 +47,7 @@ interface ChannelCardProps {config: ChannelConfig | nullonSettings: () => voidonDisconnect: () => void+ OCIsInstalled: boolean}export function ChannelCard({@@ -53,6 +55,7 @@ export function ChannelCard({config,onSettings,onDisconnect,+ OCIsInstalled,}: ChannelCardProps) {const { t } = useTranslation()@@ -61,11 +64,11 @@ export function ChannelCard({const getChannelIcon = () => {switch (type) {case 'telegram':- return <IconBrandTelegram size={24} className="text-blue-500" />+ return <IconBrandTelegram size={16} className="text-blue-500" />case 'whatsapp':- return <IconBrandWhatsapp size={24} className="text-green-500" />+ return <IconBrandWhatsapp size={16} className="text-green-500" />case 'discord':- return <IconBrandDiscord size={24} className="text-indigo-500" />+ return <IconBrandDiscord size={16} className="text-indigo-500" />}}@@ -103,30 +106,32 @@ export function ChannelCard({return (<div- className={`border rounded-lg overflow-hidden transition-all ${+ className={cn("border rounded-lg overflow-hidden transition-all",isConnected? 'border-green-500/30 bg-green-500/5': 'border-border bg-card'- }`}+ )}>{/* Header */}- <div className="flex items-center justify-between p-4">- <div className="flex items-center gap-3">- <div className="flex-shrink-0">{getChannelIcon()}</div>+ <div className="flex items-center justify-between p-2 px-3">+ <div className="flex items-center gap-2">+ <div className="shrink-0">{getChannelIcon()}</div><div><div className="flex items-center gap-2"><span className="font-medium text-foreground">{getChannelName()}</span><div- className={`w-2 h-2 rounded-full ${- isConnected ? 'bg-green-500' : 'bg-muted-foreground'- }`}+ className={cn("size-2 rounded-full", {+ 'bg-green-500': isConnected,+ 'bg-muted-foreground': !isConnected,+ })}/><span- className={`text-xs ${- isConnected ? 'text-green-500' : 'text-muted-foreground'- }`}+ className={cn("text-xs", {+ 'text-green-500': isConnected,+ 'text-muted-foreground': !isConnected,+ })}>{isConnected? t('settings:remoteAccess.connected')@@ -143,19 +148,19 @@ export function ChannelCard({<div className="flex items-center gap-2"><Button variant="outline" size="sm" onClick={onSettings}>- <IconSettings size={16} className="mr-1" />+ <IconSettings />{t('settings:remoteAccess.settings')}</Button>{isConnected && (<Button variant="ghost" size="sm" onClick={onDisconnect}>- <IconTrash size={16} />+ <IconTrash /></Button>)}</div></div>{/* Not Connected State */}- {!isConnected && (+ {!isConnected && OCIsInstalled && (<div className="border-t border-border/40 px-4 py-3 bg-muted/30"><p className="text-sm text-muted-foreground">{t('settings:remoteAccess.channelNotConnected', {diff --git a/web-app/src/routes/settings/remote-access.tsx b/web-app/src/routes/settings/remote-access.tsxindex 039bddd65..6303e5840 100644--- a/web-app/src/routes/settings/remote-access.tsx+++ b/web-app/src/routes/settings/remote-access.tsx@@ -22,12 +22,11 @@ import {IconPlugConnected,IconLink,IconLoader2,- IconPlayerPlay,- IconPlayerStop,IconPlus,IconCopy,IconExternalLink,} from '@tabler/icons-react'+import { cn } from '@/lib/utils'// eslint-disable-next-line @typescript-eslint/no-explicit-anyexport const Route = createFileRoute(route.settings.remote_access as any)({@@ -442,19 +441,24 @@ function RemoteAccess() {<div className="p-4 pt-0 w-full overflow-y-auto"><div className="flex flex-col justify-between gap-4 gap-y-3 w-full">{/* Status Card */}- <Card title={t('settings:remoteAccess.status')}>- <div className="flex items-center gap-3 mb-4">- <div- className={`w-3 h-3 rounded-full ${- isRunning ? 'bg-green-500' : 'bg-red-500'- }`}- />- <span className="text-foreground font-medium">- {isRunning- ? t('settings:remoteAccess.enabled')- : t('settings:remoteAccess.disabled')}- </span>- </div>+ <Card title={t('settings:remoteAccess.title')}>+ <CardItem+ title={t('settings:remoteAccess.status')}+ actions={+ <div className="flex items-center gap-2">+ <div+ className={cn("size-2 rounded-full",+ isRunning ? 'bg-green-500' : 'bg-red-500'+ )}+ />+ <span className="text-foreground font-medium">+ {isRunning+ ? t('settings:remoteAccess.enabled')+ : t('settings:remoteAccess.disabled')}+ </span>+ </div>+ }+ /><CardItemtitle={t('settings:remoteAccess.activeChannels')}actions={@@ -524,24 +528,19 @@ function RemoteAccess() {onClick={handleStop}disabled={isStopping}>- {isStopping ? (- <IconLoader2 className="animate-spin mr-2 h-4 w-4" />- ) : (- <IconPlayerStop className="mr-2 h-4 w-4" />+ {isStopping && (+ <IconLoader2 className="animate-spin size-4" />)}{t('settings:remoteAccess.stop')}</Button>) : (<Button- variant="secondary"size="sm"onClick={handleStart}disabled={isStarting}>- {isStarting ? (- <IconLoader2 className="animate-spin mr-2 h-4 w-4" />- ) : (- <IconPlayerPlay className="mr-2 h-4 w-4" />+ {isStarting && (+ <IconLoader2 className="animate-spin size-4" />)}{t('settings:remoteAccess.start')}</Button>@@ -554,9 +553,9 @@ function RemoteAccess() {disabled={isInstalling}>{isInstalling ? (- <IconLoader2 className="animate-spin mr-2 h-4 w-4" />+ <IconLoader2 className="animate-spin size-4 text-muted-foreground" />) : (- <IconPlugConnected className="mr-2 h-4 w-4" />+ <IconPlugConnected className="size-4 text-muted-foreground" />)}{t('settings:remoteAccess.install')}</Button>@@ -574,7 +573,7 @@ function RemoteAccess() {size="sm"onClick={() => setIsAddChannelDialogOpen(true)}>- <IconPlus className="mr-2 h-4 w-4" />+ <IconPlus className="size-4 text-muted-foreground" />{t('settings:remoteAccess.addChannel.title')}</Button>}@@ -587,27 +586,31 @@ function RemoteAccess() {config={convertTelegramConfig(telegramConfig)}onSettings={() => handleChannelSettings('telegram')}onDisconnect={() => handleDisconnectChannel('telegram')}+ OCIsInstalled={isInstalled}/><ChannelCardtype="whatsapp"config={convertWhatsAppConfig(whatsappConfig)}onSettings={() => handleChannelSettings('whatsapp')}onDisconnect={() => handleDisconnectChannel('whatsapp')}+ OCIsInstalled={isInstalled}/><ChannelCardtype="discord"config={convertDiscordConfig(discordConfig)}onSettings={() => handleChannelSettings('discord')}onDisconnect={() => handleDisconnectChannel('discord')}+ OCIsInstalled={isInstalled}/></div>{/* Share Access */}<CardItemtitle={t('settings:remoteAccess.shareAccess')}+ className='mt-5'actions={<Button variant="outline" size="sm">- <IconLink className="mr-2 h-4 w-4" />+ <IconLink className="size-4 text-muted-foreground" />{t('settings:remoteAccess.generateInviteLink')}</Button>}