mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Show labels settings always, disabled until labels exist
- Project Labels section now always visible in Preferences - Toggle switches are grayed out and disabled when no labels exist - Added helper text "Create a label to enable these settings" - Users can still click "Manage Labels" to create their first label - Added translations for new helper text in all 6 languages
This commit is contained in:
1 parent
7e7ef35ff6
commit
18d088660f
7 files changed
+47
-34
No files matched your search
+2
-1
@@ -543,5 +543,6 @@
|
||||
"showColoredIconsDescription": "Show the folder icon in the label's color for labeled projects.",
|
||||
"groupByLabel": "Group by label",
|
||||
"groupByLabelDescription": "Organize projects into collapsible groups based on their labels.",
|
||||
"unlabeled": "Unlabeled"
|
||||
"unlabeled": "Unlabeled",
|
||||
"createLabelToEnableSettings": "Create a label to enable these settings"
|
||||
}
|
||||
+2
-1
@@ -450,5 +450,6 @@
|
||||
"showColoredIconsDescription": "Nuna alamar fayil a launin lakabi don ayyukan da aka yi musu lakabi.",
|
||||
"groupByLabel": "Haɗa da lakabi",
|
||||
"groupByLabelDescription": "Tsara ayyuka cikin ƙungiyoyi masu rufewa dangane da lakabin su.",
|
||||
"unlabeled": "Babu lakabi"
|
||||
"unlabeled": "Babu lakabi",
|
||||
"createLabelToEnableSettings": "Ƙirƙiri lakabi don kunna waɗannan saituna"
|
||||
}
|
||||
+2
-1
@@ -447,5 +447,6 @@
|
||||
"showColoredIconsDescription": "Gosi akara nchekwa n'agba akara maka ọrụ nwere akara.",
|
||||
"groupByLabel": "Kekọta site n'akara",
|
||||
"groupByLabelDescription": "Hazie ọrụ n'ime otu ndị a pụrụ imechi dabere n'akara ha.",
|
||||
"unlabeled": "Enweghị akara"
|
||||
"unlabeled": "Enweghị akara",
|
||||
"createLabelToEnableSettings": "Mepụta akara iji mee ka ntọala ndị a rụọ ọrụ"
|
||||
}
|
||||
+2
-1
@@ -459,5 +459,6 @@
|
||||
"showColoredIconsDescription": "Mostrar o ícone da pasta na cor da etiqueta para projetos etiquetados.",
|
||||
"groupByLabel": "Agrupar por etiqueta",
|
||||
"groupByLabelDescription": "Organizar projetos em grupos recolhíveis com base em suas etiquetas.",
|
||||
"unlabeled": "Sem etiqueta"
|
||||
"unlabeled": "Sem etiqueta",
|
||||
"createLabelToEnableSettings": "Crie uma etiqueta para ativar estas configurações"
|
||||
}
|
||||
+2
-1
@@ -447,5 +447,6 @@
|
||||
"showColoredIconsDescription": "Fi ìkọ́ fáìlì hàn ní àwọ̀ àmì fún àwọn iṣẹ́ tí wọ́n ní àmì.",
|
||||
"groupByLabel": "Ṣàkójọ nípa àmì",
|
||||
"groupByLabelDescription": "Ṣètò àwọn iṣẹ́ sí ẹgbẹ́ tí wọ́n lè pa mọ́ dà lórí àmì wọn.",
|
||||
"unlabeled": "Kò ní àmì"
|
||||
"unlabeled": "Kò ní àmì",
|
||||
"createLabelToEnableSettings": "Ṣẹ̀dá àmì láti mú àwọn ètò wọ̀nyí ṣiṣẹ́"
|
||||
}
|
||||
+2
-1
@@ -459,5 +459,6 @@
|
||||
"showColoredIconsDescription": "为有标签的项目显示标签颜色的文件夹图标。",
|
||||
"groupByLabel": "按标签分组",
|
||||
"groupByLabelDescription": "根据标签将项目组织成可折叠的分组。",
|
||||
"unlabeled": "无标签"
|
||||
"unlabeled": "无标签",
|
||||
"createLabelToEnableSettings": "创建标签以启用这些设置"
|
||||
}
|
||||
+35
-28
@@ -11,7 +11,6 @@ import { useIsMobile } from "@/hooks/useIsMobile";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useAppContext } from "@/hooks/useAppContext";
|
||||
import { useLabels } from "@/hooks/useLabels";
|
||||
import { useProjectLabels } from "@/hooks/useProjectLabels";
|
||||
import { LabelsManageDialog } from "@/components/labels/LabelsManageDialog";
|
||||
|
||||
export function Preferences() {
|
||||
@@ -20,11 +19,10 @@ export function Preferences() {
|
||||
const navigate = useNavigate();
|
||||
const { config, updateConfig } = useAppContext();
|
||||
const { labels, displaySettings, updateDisplaySettings } = useLabels();
|
||||
const { hasAnyLabels } = useProjectLabels();
|
||||
const [labelsDialogOpen, setLabelsDialogOpen] = useState(false);
|
||||
|
||||
// Only show label settings if user has created labels or assigned labels to projects
|
||||
const showLabelSettings = labels.length > 0 || hasAnyLabels();
|
||||
// Settings are disabled until user creates at least one label
|
||||
const hasLabels = labels.length > 0;
|
||||
|
||||
return (
|
||||
<div className="p-6 space-y-6">
|
||||
@@ -112,17 +110,17 @@ export function Preferences() {
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{/* Labels Settings - Only shown when user has labels */}
|
||||
{showLabelSettings && (
|
||||
<Card className="max-w-md">
|
||||
<CardHeader className="pb-4">
|
||||
<CardTitle className="flex items-center gap-2 text-lg">
|
||||
<Tag className="h-5 w-5 text-primary" />
|
||||
{t('projectLabels')}
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="space-y-6">
|
||||
{/* Labels Settings */}
|
||||
<Card className="max-w-md">
|
||||
<CardHeader className="pb-4">
|
||||
<CardTitle className="flex items-center gap-2 text-lg">
|
||||
<Tag className="h-5 w-5 text-primary" />
|
||||
{t('projectLabels')}
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="space-y-6">
|
||||
<div className={!hasLabels ? "opacity-50" : undefined}>
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="space-y-0.5">
|
||||
@@ -136,13 +134,16 @@ export function Preferences() {
|
||||
onCheckedChange={(checked) => {
|
||||
updateDisplaySettings({ showColoredIcons: checked });
|
||||
}}
|
||||
disabled={!hasLabels}
|
||||
/>
|
||||
</div>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{t('showColoredIconsDescription')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className={!hasLabels ? "opacity-50" : undefined}>
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="space-y-0.5">
|
||||
@@ -156,26 +157,32 @@ export function Preferences() {
|
||||
onCheckedChange={(checked) => {
|
||||
updateDisplaySettings({ groupByLabel: checked });
|
||||
}}
|
||||
disabled={!hasLabels}
|
||||
/>
|
||||
</div>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{t('groupByLabelDescription')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="pt-2">
|
||||
<Button
|
||||
variant="outline"
|
||||
className="w-full"
|
||||
onClick={() => setLabelsDialogOpen(true)}
|
||||
>
|
||||
{t('manageLabels')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
<div className="pt-2">
|
||||
<Button
|
||||
variant="outline"
|
||||
className="w-full"
|
||||
onClick={() => setLabelsDialogOpen(true)}
|
||||
>
|
||||
{t('manageLabels')}
|
||||
</Button>
|
||||
{!hasLabels && (
|
||||
<p className="text-xs text-muted-foreground text-center mt-2">
|
||||
{t('createLabelToEnableSettings')}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<LabelsManageDialog
|
||||
open={labelsDialogOpen}
|
||||
|
||||
Reference in new issue
Block a user