Compare commits

..

2 Commits

5 changed files with 65 additions and 58 deletions

View File

@@ -4,7 +4,8 @@
"version": "0.0.0", "version": "0.0.0",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "bunx --bun vite --open", "dev:web": "VITE_APP_MODE=web bunx --bun vite",
"dev:electron": "bunx --bun vite --open",
"build": "tsc && bunx --bun vite build && electron-builder", "build": "tsc && bunx --bun vite build && electron-builder",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "bunx --bun vite preview" "preview": "bunx --bun vite preview"

View File

@@ -65,7 +65,7 @@ function App(props: { socket: Socket }) {
return ( return (
<ErrorBoundary> <ErrorBoundary>
<QueryClientProvider client={queryClient}> <QueryClientProvider client={queryClient}>
<ThemeProvider defaultTheme="system" storageKey="discord-theme"> <ThemeProvider defaultTheme="system" storageKey="concord-theme">
<Router> <Router>
<div className="h-screen w-screen overflow-hidden bg-background text-foreground"> <div className="h-screen w-screen overflow-hidden bg-background text-foreground">
<Routes> <Routes>

View File

@@ -558,9 +558,8 @@ const ChatPage: React.FC = () => {
</div> </div>
); );
} else if (!channelId || !currentChannel) { } else if (!channelId || !currentChannel) {
const existingChannelId = categories const existingChannelId = categories?.flatMap((cat) => cat.channels)?.[0]
?.flatMap((cat) => cat.channels) ?.id; // Get the first channel from the flattened list
?.find((channel) => channel.position === 0)?.id;
if (existingChannelId) { if (existingChannelId) {
navigate(`/channels/${instanceId}/${existingChannelId}`); navigate(`/channels/${instanceId}/${existingChannelId}`);

View File

@@ -5,9 +5,15 @@ import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite"; import tailwindcss from "@tailwindcss/vite";
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig(({ mode }) => {
// Check if VITE_APP_MODE is set to 'web'
const isWebApp = process.env.VITE_APP_MODE === "web";
return {
plugins: [ plugins: [
react(), react(),
// Only include the electron plugin if not in 'web' app mode
!isWebApp &&
electron({ electron({
main: { main: {
// Shortcut of `build.lib.entry`. // Shortcut of `build.lib.entry`.
@@ -28,10 +34,11 @@ export default defineConfig({
: {}, : {},
}), }),
tailwindcss(), tailwindcss(),
], ].filter(Boolean), // Filter out 'false' values if electron plugin is not included
resolve: { resolve: {
alias: { alias: {
"@": path.resolve(__dirname, "./src"), "@": path.resolve(__dirname, "./src"),
}, },
}, },
};
}); });