feat: config.js

This commit is contained in:
Vasily Zubarev
2025-04-03 14:36:16 +02:00
parent f523b1f8ba
commit f1a26e511e
26 changed files with 165 additions and 126 deletions

View File

@@ -2,7 +2,7 @@
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import { useSidebar } from "@/components/ui/sidebar"
import { APP_TITLE } from "@/lib/constants"
import config from "@/lib/config"
import Link from "next/link"
export default function MobileMenu({ unsortedFilesCount }: { unsortedFilesCount: number }) {
@@ -15,7 +15,7 @@ export default function MobileMenu({ unsortedFilesCount }: { unsortedFilesCount:
<AvatarFallback className="rounded-lg">AI</AvatarFallback>
</Avatar>
<Link href="/" className="text-lg font-bold">
{APP_TITLE}
{config.app.title}
</Link>
<Link
href="/unsorted"

View File

@@ -10,12 +10,11 @@ import {
import { SidebarMenuButton } from "@/components/ui/sidebar"
import { UserProfile } from "@/lib/auth"
import { authClient } from "@/lib/auth-client"
import { IS_SELF_HOSTED_MODE } from "@/lib/constants"
import { LogOut, MoreVertical, User } from "lucide-react"
import Link from "next/link"
import { redirect } from "next/navigation"
export default function SidebarUser({ profile }: { profile: UserProfile }) {
export default function SidebarUser({ profile, isSelfHosted }: { profile: UserProfile; isSelfHosted: boolean }) {
const signOut = async () => {
await authClient.signOut({})
redirect("/")
@@ -61,14 +60,16 @@ export default function SidebarUser({ profile }: { profile: UserProfile }) {
</Link>
</DropdownMenuItem> */}
</DropdownMenuGroup>
<DropdownMenuSeparator />
{!IS_SELF_HOSTED_MODE && (
<DropdownMenuItem asChild>
<span onClick={signOut} className="flex items-center gap-2 text-red-600 cursor-pointer">
<LogOut className="h-4 w-4" />
Log out
</span>
</DropdownMenuItem>
{!isSelfHosted && (
<>
<DropdownMenuSeparator />
<DropdownMenuItem asChild>
<span onClick={signOut} className="flex items-center gap-2 text-red-600 cursor-pointer">
<LogOut className="h-4 w-4" />
Log out
</span>
</DropdownMenuItem>
</>
)}
</DropdownMenuContent>
</DropdownMenu>

View File

@@ -17,7 +17,7 @@ import {
useSidebar,
} from "@/components/ui/sidebar"
import { UserProfile } from "@/lib/auth"
import { APP_TITLE, IS_SELF_HOSTED_MODE } from "@/lib/constants"
import config from "@/lib/config"
import { ClockArrowUp, FileText, Import, LayoutDashboard, Settings, Sparkles, Upload } from "lucide-react"
import Image from "next/image"
import Link from "next/link"
@@ -28,7 +28,15 @@ import { Blinker } from "./blinker"
import { SidebarMenuItemWithHighlight } from "./sidebar-item"
import SidebarUser from "./sidebar-user"
export function AppSidebar({ unsortedFilesCount, profile }: { unsortedFilesCount: number; profile: UserProfile }) {
export function AppSidebar({
profile,
unsortedFilesCount,
isSelfHosted,
}: {
profile: UserProfile
unsortedFilesCount: number
isSelfHosted: boolean
}) {
const { open, setOpenMobile } = useSidebar()
const pathname = usePathname()
const { notification } = useNotification()
@@ -46,7 +54,7 @@ export function AppSidebar({ unsortedFilesCount, profile }: { unsortedFilesCount
<Image src="/logo/256.png" alt="Logo" className="h-10 w-10 rounded-lg" width={40} height={40} />
<div className="grid flex-1 text-left leading-tight">
<span className="truncate font-semibold text-lg">
<ColoredText>{APP_TITLE}</ColoredText>
<ColoredText>{config.app.title}</ColoredText>
</span>
</div>
</Link>
@@ -124,7 +132,7 @@ export function AppSidebar({ unsortedFilesCount, profile }: { unsortedFilesCount
</Link>
</SidebarMenuButton>
</SidebarMenuItem>
{IS_SELF_HOSTED_MODE && (
{isSelfHosted && (
<SidebarMenuItem>
<SidebarMenuButton asChild>
<Link href="https://vas3k.com/donate/" target="_blank">
@@ -146,7 +154,7 @@ export function AppSidebar({ unsortedFilesCount, profile }: { unsortedFilesCount
<SidebarGroupContent>
<SidebarMenu>
<SidebarMenuItem>
<SidebarUser profile={profile} />
<SidebarUser profile={profile} isSelfHosted={isSelfHosted} />
</SidebarMenuItem>
</SidebarMenu>
</SidebarGroupContent>