mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Remove labels preferences
This commit is contained in:
9 files changed
+11
-123
No files matched your search
@@ -24,7 +24,6 @@ interface ProjectItemProps {
|
||||
onSelect: (project: Project) => void;
|
||||
isFavorite?: boolean;
|
||||
labelColor?: string;
|
||||
showColoredIcon?: boolean;
|
||||
}
|
||||
|
||||
const ProjectItem: React.FC<ProjectItemProps> = ({
|
||||
@@ -33,7 +32,6 @@ const ProjectItem: React.FC<ProjectItemProps> = ({
|
||||
onSelect,
|
||||
isFavorite,
|
||||
labelColor,
|
||||
showColoredIcon = false,
|
||||
}) => {
|
||||
const navigate = useNavigate();
|
||||
const { hasRunningSessions } = useProjectSessionStatus(project.id);
|
||||
@@ -43,9 +41,9 @@ const ProjectItem: React.FC<ProjectItemProps> = ({
|
||||
navigate(`/project/${project.id}`);
|
||||
};
|
||||
|
||||
// Determine folder icon color
|
||||
// Determine folder icon color - always show colored icons when label exists
|
||||
const getFolderColorClass = () => {
|
||||
if (showColoredIcon && labelColor) {
|
||||
if (labelColor) {
|
||||
const colorConfig = getLabelColor(labelColor as Parameters<typeof getLabelColor>[0]);
|
||||
return colorConfig.text;
|
||||
}
|
||||
@@ -151,14 +149,14 @@ export function ProjectSidebar({
|
||||
const { data: projects = [], isLoading, error } = useProjects();
|
||||
const [favorites] = useLocalStorage<string[]>('project-favorites', []);
|
||||
const [searchQuery, setSearchQuery] = useState('');
|
||||
const { labels, displaySettings, toggleLabelCollapsed } = useLabels();
|
||||
const { labels, toggleLabelCollapsed } = useLabels();
|
||||
const { getProjectLabels, hasAnyLabels } = useProjectLabels();
|
||||
|
||||
const isMobile = useIsMobile();
|
||||
const navigate = useNavigate();
|
||||
|
||||
// Determine if we should show grouped view
|
||||
const showGroupedView = displaySettings.groupByLabel && labels.length > 0 && hasAnyLabels();
|
||||
// Always show grouped view when labels exist and projects have labels
|
||||
const showGroupedView = labels.length > 0 && hasAnyLabels();
|
||||
|
||||
// Fast in-memory search filtering
|
||||
const filteredProjects = useMemo(() => {
|
||||
@@ -404,7 +402,6 @@ export function ProjectSidebar({
|
||||
onSelect={onSelectProject}
|
||||
isFavorite={favorites.includes(project.id)}
|
||||
labelColor={label.color}
|
||||
showColoredIcon={displaySettings.showColoredIcons}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
@@ -444,7 +441,6 @@ export function ProjectSidebar({
|
||||
onSelect={onSelectProject}
|
||||
isFavorite={favorites.includes(project.id)}
|
||||
labelColor={getProjectLabelColor(project.id)}
|
||||
showColoredIcon={displaySettings.showColoredIcons}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -31,18 +31,6 @@ export interface Label {
|
||||
collapsed?: boolean;
|
||||
}
|
||||
|
||||
export interface LabelDisplaySettings {
|
||||
/** Show colored folder icons for labeled projects */
|
||||
showColoredIcons: boolean;
|
||||
/** Group projects by label in sidebar */
|
||||
groupByLabel: boolean;
|
||||
}
|
||||
|
||||
const DEFAULT_DISPLAY_SETTINGS: LabelDisplaySettings = {
|
||||
showColoredIcons: false,
|
||||
groupByLabel: false,
|
||||
};
|
||||
|
||||
/** Get the color config for a label color name */
|
||||
export function getLabelColor(colorName: LabelColorName) {
|
||||
return LABEL_COLORS.find(c => c.name === colorName) || LABEL_COLORS[0];
|
||||
@@ -58,10 +46,6 @@ function generateLabelId(): string {
|
||||
*/
|
||||
export function useLabels() {
|
||||
const [labels, setLabels] = useLocalStorage<Label[]>('project-labels', []);
|
||||
const [displaySettings, setDisplaySettings] = useLocalStorage<LabelDisplaySettings>(
|
||||
'project-labels-display',
|
||||
DEFAULT_DISPLAY_SETTINGS
|
||||
);
|
||||
|
||||
const createLabel = (name: string, color: LabelColorName): Label => {
|
||||
const newLabel: Label = {
|
||||
@@ -96,18 +80,12 @@ export function useLabels() {
|
||||
));
|
||||
};
|
||||
|
||||
const updateDisplaySettings = (updates: Partial<LabelDisplaySettings>) => {
|
||||
setDisplaySettings({ ...displaySettings, ...updates });
|
||||
};
|
||||
|
||||
return {
|
||||
labels,
|
||||
displaySettings,
|
||||
createLabel,
|
||||
updateLabel,
|
||||
deleteLabel,
|
||||
reorderLabels,
|
||||
toggleLabelCollapsed,
|
||||
updateDisplaySettings,
|
||||
};
|
||||
}
|
||||
+1
-6
@@ -539,10 +539,5 @@
|
||||
"selectLabels": "Select labels",
|
||||
"noLabelsCreated": "No labels created yet",
|
||||
"createNewLabel": "Create new label",
|
||||
"showColoredIcons": "Colored folder icons",
|
||||
"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",
|
||||
"createLabelToEnableSettings": "Create a label to enable these settings"
|
||||
"unlabeled": "Unlabeled"
|
||||
}
|
||||
+1
-6
@@ -446,10 +446,5 @@
|
||||
"selectLabels": "Zaɓi lakabi",
|
||||
"noLabelsCreated": "Ba a ƙirƙiri lakabi tukuna ba",
|
||||
"createNewLabel": "Ƙirƙiri sabon lakabi",
|
||||
"showColoredIcons": "Alamomin fayil masu launi",
|
||||
"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",
|
||||
"createLabelToEnableSettings": "Ƙirƙiri lakabi don kunna waɗannan saituna"
|
||||
"unlabeled": "Babu lakabi"
|
||||
}
|
||||
+1
-6
@@ -443,10 +443,5 @@
|
||||
"selectLabels": "Họrọ akara",
|
||||
"noLabelsCreated": "Emepụtaghị akara ọ bụla",
|
||||
"createNewLabel": "Mepụta akara ọhụrụ",
|
||||
"showColoredIcons": "Akara nchekwa nwere agba",
|
||||
"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",
|
||||
"createLabelToEnableSettings": "Mepụta akara iji mee ka ntọala ndị a rụọ ọrụ"
|
||||
"unlabeled": "Enweghị akara"
|
||||
}
|
||||
+1
-6
@@ -455,10 +455,5 @@
|
||||
"selectLabels": "Selecionar etiquetas",
|
||||
"noLabelsCreated": "Nenhuma etiqueta criada ainda",
|
||||
"createNewLabel": "Criar nova etiqueta",
|
||||
"showColoredIcons": "Ícones de pasta coloridos",
|
||||
"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",
|
||||
"createLabelToEnableSettings": "Crie uma etiqueta para ativar estas configurações"
|
||||
"unlabeled": "Sem etiqueta"
|
||||
}
|
||||
+1
-6
@@ -443,10 +443,5 @@
|
||||
"selectLabels": "Yan àmì",
|
||||
"noLabelsCreated": "A kò tí ì ṣẹ̀dá àmì kankan",
|
||||
"createNewLabel": "Ṣẹ̀dá àmì tuntun",
|
||||
"showColoredIcons": "Àwọn ìkọ́ fáìlì oníàwọ̀",
|
||||
"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ì",
|
||||
"createLabelToEnableSettings": "Ṣẹ̀dá àmì láti mú àwọn ètò wọ̀nyí ṣiṣẹ́"
|
||||
"unlabeled": "Kò ní àmì"
|
||||
}
|
||||
+1
-6
@@ -455,10 +455,5 @@
|
||||
"selectLabels": "选择标签",
|
||||
"noLabelsCreated": "尚未创建标签",
|
||||
"createNewLabel": "创建新标签",
|
||||
"showColoredIcons": "彩色文件夹图标",
|
||||
"showColoredIconsDescription": "为有标签的项目显示标签颜色的文件夹图标。",
|
||||
"groupByLabel": "按标签分组",
|
||||
"groupByLabelDescription": "根据标签将项目组织成可折叠的分组。",
|
||||
"unlabeled": "无标签",
|
||||
"createLabelToEnableSettings": "创建标签以启用这些设置"
|
||||
"unlabeled": "无标签"
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import { Label } from "@/components/ui/label";
|
||||
import { useIsMobile } from "@/hooks/useIsMobile";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useAppContext } from "@/hooks/useAppContext";
|
||||
import { useLabels } from "@/hooks/useLabels";
|
||||
import { LabelsManageDialog } from "@/components/labels/LabelsManageDialog";
|
||||
|
||||
export function Preferences() {
|
||||
@@ -18,12 +17,8 @@ export function Preferences() {
|
||||
const isMobile = useIsMobile();
|
||||
const navigate = useNavigate();
|
||||
const { config, updateConfig } = useAppContext();
|
||||
const { labels, displaySettings, updateDisplaySettings } = useLabels();
|
||||
const [labelsDialogOpen, setLabelsDialogOpen] = useState(false);
|
||||
|
||||
// Settings are disabled until user creates at least one label
|
||||
const hasLabels = labels.length > 0;
|
||||
|
||||
return (
|
||||
<div className="p-6 space-y-6">
|
||||
{isMobile && (
|
||||
@@ -120,52 +115,6 @@ export function Preferences() {
|
||||
</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">
|
||||
<Label htmlFor="colored-icons" className="text-sm font-medium">
|
||||
{t('showColoredIcons')}
|
||||
</Label>
|
||||
</div>
|
||||
<Switch
|
||||
id="colored-icons"
|
||||
checked={displaySettings.showColoredIcons}
|
||||
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">
|
||||
<Label htmlFor="group-by-label" className="text-sm font-medium">
|
||||
{t('groupByLabel')}
|
||||
</Label>
|
||||
</div>
|
||||
<Switch
|
||||
id="group-by-label"
|
||||
checked={displaySettings.groupByLabel}
|
||||
onCheckedChange={(checked) => {
|
||||
updateDisplaySettings({ groupByLabel: checked });
|
||||
}}
|
||||
disabled={!hasLabels}
|
||||
/>
|
||||
</div>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{t('groupByLabelDescription')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="pt-2">
|
||||
<Button
|
||||
variant="outline"
|
||||
@@ -174,11 +123,6 @@ export function Preferences() {
|
||||
>
|
||||
{t('manageLabels')}
|
||||
</Button>
|
||||
{!hasLabels && (
|
||||
<p className="text-xs text-muted-foreground text-center mt-2">
|
||||
{t('createLabelToEnableSettings')}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
|
||||
Reference in new issue
Block a user