Merge pull request #3 from recurse-chat/fix-bugs

Fix bugs
This commit is contained in:
2026-08-19 14:48:37 -04:00
committed by GitHub
6 changed files with 16 additions and 12 deletions
+1
View File
@@ -22,6 +22,7 @@ fn accounts_file_path(app: &AppHandle) -> Result<std::path::PathBuf, String> {
.path() .path()
.app_data_dir() .app_data_dir()
.map_err(|e| format!("Failed to resolve app data dir: {e}"))?; .map_err(|e| format!("Failed to resolve app data dir: {e}"))?;
fs::create_dir_all(&dir).map_err(|e| format!("Failed to create app data dir: {e}"))?; fs::create_dir_all(&dir).map_err(|e| format!("Failed to create app data dir: {e}"))?;
Ok(dir.join("accounts.json")) Ok(dir.join("accounts.json"))
} }
+1 -2
View File
@@ -41,10 +41,9 @@ pub fn save_server_list(app: AppHandle, servers: ServerList) -> Result<(), Strin
#[tauri::command] #[tauri::command]
pub fn get_server_list(app: AppHandle) -> Result<ServerList, String> { pub fn get_server_list(app: AppHandle) -> Result<ServerList, String> {
let path = servers_file_path(&app)?; let path = servers_file_path(&app)?;
println!("{path:?}");
if !path.exists() { if !path.exists() {
fs::write(&path, "[]").map_err(|e| format!("Failed to write first server list: {e}"))?;
return Ok(ServerList::new()); return Ok(ServerList::new());
} }
+6 -2
View File
@@ -66,10 +66,14 @@ export default class Enclave {
} }
if ( if (
this.serverList[hostname]?.publicKey !== this.serverList[hostname] &&
this.serverList[hostname].publicKey !==
base58.encode(this.server.serverPublicKey) base58.encode(this.server.serverPublicKey)
) { ) {
console.error("Server's new public key doesn't match old one"); console.error("Server's new public key doesn't match old one", {
old: this.serverList[hostname].publicKey,
new: base58.encode(this.server.serverPublicKey),
});
return; return;
} }
+5 -5
View File
@@ -18,14 +18,14 @@ export default function AccountCard({
return ( return (
<div className="absolute -left-16 right-16 bottom-0 h-20 w-[calc(100%+4rem-2rem)] z-10 ml-4 mb-4 @max-[150px]:hidden"> <div className="absolute -left-16 right-16 bottom-0 h-20 w-[calc(100%+4rem-2rem)] z-10 ml-4 mb-4 @max-[150px]:hidden">
<Card className="px-3 py-3 h-full w-full flex flex-row"> <Card className="px-3 py-3 h-full w-full flex flex-row">
<div className="flex gap-2.5 items-center"> <div className="flex gap-2.5 items-center w-full">
<Avatar className="h-full w-auto aspect-square"> <Avatar className="h-full w-auto aspect-square">
<AvatarImage src={account.avatar} /> <AvatarImage src={account.avatar} />
<AvatarFallback>{account.displayName[0]}</AvatarFallback> <AvatarFallback>{account.displayName[0]}</AvatarFallback>
</Avatar> </Avatar>
<div className="flex flex-col"> <div className="flex flex-col w-full">
<span <span
className="flex items-center gap-1.5 cursor-pointer" className="flex items-center gap-1.5 cursor-pointer w-full"
onClick={() => { onClick={() => {
navigator.clipboard.writeText( navigator.clipboard.writeText(
base58.encode( base58.encode(
@@ -34,13 +34,13 @@ export default function AccountCard({
); );
}} }}
> >
{account.displayName} <p>{account.displayName}</p>
<CopyIcon className="text-muted-foreground size-3" /> <CopyIcon className="text-muted-foreground size-3" />
</span> </span>
<span className="text-muted-foreground">Online</span> <span className="text-muted-foreground">Online</span>
</div> </div>
</div> </div>
<div className="ml-auto flex items-center text-muted-foreground"> <div className="flex items-center text-muted-foreground">
<Button variant="ghost" className="size-10"> <Button variant="ghost" className="size-10">
<Settings2Icon className="size-5.5" /> <Settings2Icon className="size-5.5" />
</Button> </Button>
+2 -2
View File
@@ -43,9 +43,9 @@ export function RenderCategory({ channel }: { channel: Channel }) {
export function RenderChannels({ channels }: { channels: Channel[] }) { export function RenderChannels({ channels }: { channels: Channel[] }) {
return channels.map((channel) => return channels.map((channel) =>
channel.kind === "category" ? ( channel.kind === "category" ? (
<RenderCategory channel={channel} /> <RenderCategory key={channel.id} channel={channel} />
) : ( ) : (
<div className="w-full hover:bg-accent px-2.5 py-1.5 rounded-md flex gap-2.5 items-center select-none cursor-default text-sm text-muted-foreground"> <div key={channel.id} className="w-full hover:bg-accent px-2.5 py-1.5 rounded-md flex gap-2.5 items-center select-none cursor-default text-sm text-muted-foreground">
<ChannelIcon kind={channel.kind} /> <ChannelIcon kind={channel.kind} />
{channel.name} {channel.name}
</div> </div>