added notification that profiles are missing

This commit is contained in:
coolcoala
2025-07-13 22:55:20 +03:00
parent 8e0f5b6abd
commit f9376f6903
3 changed files with 54 additions and 29 deletions

View File

@@ -641,8 +641,10 @@
"Invalid Profile URL": "Invalid profile URL. Please enter a URL starting with http:// or https://", "Invalid Profile URL": "Invalid profile URL. Please enter a URL starting with http:// or https://",
"Saved Successfully": "Saved successfully", "Saved Successfully": "Saved successfully",
"Connected": "Connected", "Connected": "Connected",
"Disconnected": "Disconnected",
"Attention Required": "Attention Required",
"Menu": "Menu", "Menu": "Menu",
"Add New Profile": "Add New Profile", "Add Profile": "Add Profile",
"Delete Profile": "Delete Profile {{name}}?", "Delete Profile": "Delete Profile {{name}}?",
"This action cannot be undone.": "This action cannot be undone.", "This action cannot be undone.": "This action cannot be undone.",
"Check Group Latency": "Check Group Latency", "Check Group Latency": "Check Group Latency",
@@ -650,5 +652,9 @@
"Show Basic Info": "Show Basic Info", "Show Basic Info": "Show Basic Info",
"Show Detailed Info": "Show Detailed Info", "Show Detailed Info": "Show Detailed Info",
"Set Latency Test URL": "Set Latency Test URL", "Set Latency Test URL": "Set Latency Test URL",
"Filter by Name": "Filter by Name" "Filter by Name": "Filter by Name",
"Expires in": "Expires in {{duration}}",
"Expired": "Expired",
"Get Started": "Get Started",
"You don't have any profiles yet. Add your first one to begin.": "You don't have any profiles yet.\nAdd your first one to begin."
} }

View File

@@ -591,7 +591,7 @@
"Proxy disabled": "Прокси выключено", "Proxy disabled": "Прокси выключено",
"Connecting...": "Подключение...", "Connecting...": "Подключение...",
"Disconnecting...": "Отключение...", "Disconnecting...": "Отключение...",
"Add New Profile": "Добавить новый профиль", "Add Profile": "Добавить профиль",
"Delete Profile": "Удалить профиль {{name}}?", "Delete Profile": "Удалить профиль {{name}}?",
"This action cannot be undone.": "Это действие не может быть отменено", "This action cannot be undone.": "Это действие не может быть отменено",
"Update via proxy": "Обновить через прокси", "Update via proxy": "Обновить через прокси",
@@ -604,5 +604,9 @@
"Update with Clash proxy successfully": "Обновление с помощью прокси Clash прошло успешно", "Update with Clash proxy successfully": "Обновление с помощью прокси Clash прошло успешно",
"Proxy Count": "Число прокси", "Proxy Count": "Число прокси",
"Set Latency Test URL": "Установить URL-адрес тестирования задержки", "Set Latency Test URL": "Установить URL-адрес тестирования задержки",
"Filter by Name": "Фильтр по имени" "Filter by Name": "Фильтр по имени",
"Expires in": "Истекает через {{duration}}",
"Expired": "Истекло",
"Get Started": "Приступить к работе",
"You don't have any profiles yet. Add your first one to begin.": "У вас еще нет профилей.\nДобавьте свой первый профиль, чтобы начать."
} }

View File

@@ -95,31 +95,33 @@ const MinimalHomePage: React.FC = () => {
<header className="absolute top-0 left-0 right-0 p-5 flex items-center justify-between z-20"> <header className="absolute top-0 left-0 right-0 p-5 flex items-center justify-between z-20">
<div className="w-10"></div> <div className="w-10"></div>
<div className="flex-shrink-0"> {profileItems.length > 0 && (
<DropdownMenu> <div className="flex-shrink-0">
<DropdownMenuTrigger asChild> <DropdownMenu>
<Button variant="outline" className="w-full max-w-[250px] sm:max-w-xs"> <DropdownMenuTrigger asChild>
<span className="truncate">{currentProfileName}</span> <Button variant="outline" className="w-full max-w-[250px] sm:max-w-xs">
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" /> <span className="truncate">{currentProfileName}</span>
</Button> <ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
</DropdownMenuTrigger> </Button>
<DropdownMenuContent className="w-[--radix-dropdown-menu-trigger-width]"> </DropdownMenuTrigger>
<DropdownMenuLabel>{t("Profiles")}</DropdownMenuLabel> <DropdownMenuContent className="w-[--radix-dropdown-menu-trigger-width]">
<DropdownMenuSeparator /> <DropdownMenuLabel>{t("Profiles")}</DropdownMenuLabel>
{profileItems.map((p) => ( <DropdownMenuSeparator />
<DropdownMenuItem key={p.uid} onSelect={() => handleProfileChange(p.uid)}> {profileItems.map((p) => (
<span className="flex-1 truncate">{p.name}</span> <DropdownMenuItem key={p.uid} onSelect={() => handleProfileChange(p.uid)}>
{profiles?.current === p.uid && <Check className="ml-4 h-4 w-4" />} <span className="flex-1 truncate">{p.name}</span>
{profiles?.current === p.uid && <Check className="ml-4 h-4 w-4" />}
</DropdownMenuItem>
))}
<DropdownMenuSeparator />
<DropdownMenuItem onSelect={() => viewerRef.current?.create()}>
<PlusCircle className="mr-2 h-4 w-4" />
<span>{t("Add New Profile")}</span>
</DropdownMenuItem> </DropdownMenuItem>
))} </DropdownMenuContent>
<DropdownMenuSeparator /> </DropdownMenu>
<DropdownMenuItem onSelect={() => viewerRef.current?.create()}> </div>
<PlusCircle className="mr-2 h-4 w-4" /> )}
<span>{t("Add New Profile")}</span>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</div>
<div className="w-10"> <div className="w-10">
<DropdownMenu> <DropdownMenu>
@@ -180,8 +182,21 @@ const MinimalHomePage: React.FC = () => {
</div> </div>
)} )}
<div className="w-full"> <div className="w-full mt-4 flex justify-center">
{profileItems.length > 0 ? (
<ProxySelectors /> <ProxySelectors />
) : (
<Alert className="flex flex-col items-center gap-2 text-center">
<PlusCircle className="h-4 w-4" />
<AlertTitle>{t("Get Started")}</AlertTitle>
<AlertDescription className="whitespace-pre-wrap">
{t("You don't have any profiles yet. Add your first one to begin.")}
</AlertDescription>
<Button className="mt-2" onClick={() => viewerRef.current?.create()}>
{t("Add Profile")}
</Button>
</Alert>
)}
</div> </div>
</div> </div>