Skip to content

Commit

Permalink
Added badge to attribute tab, which helps users to clear saved filters
Browse files Browse the repository at this point in the history
  • Loading branch information
ransome1 committed Jan 7, 2025
1 parent 41cc929 commit 958b7b6
Show file tree
Hide file tree
Showing 20 changed files with 50 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"splashscreen.noTodosAvailable.text": "V tomto souboru nejsou žádné úkoly",
"splashscreen.noTodosAvailable.create": "Vytvořit úkol",
"splashscreen.noTodosVisible.text": "Žádné výsledky nejsou viditelné.",
"splashscreen.noTodosVisible.reset": "Obnovit filtry a hledání",
"splashscreen.noTodosVisible.reset": "Obnovit filtry",
"search.visibleTodos": "Viditelné úkoly: ",
"search.addAsTodo": "Přidat jako úkol",
"search.filters.create": "Vytvořit vyhledávací filtr",
Expand Down
2 changes: 1 addition & 1 deletion src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"splashscreen.noTodosAvailable.text": "Keine Aufgaben in dieser Datei",
"splashscreen.noTodosAvailable.create": "Eine Aufgabe erstellen",
"splashscreen.noTodosVisible.text": "Keine sichtbaren Ergebnisse.",
"splashscreen.noTodosVisible.reset": "Filter und Suche zurücksetzen",
"splashscreen.noTodosVisible.reset": "Filter zurücksetzen",
"search.visibleTodos": "Sichtbare Aufgaben: ",
"search.addAsTodo": "Als Aufgabe hinzufügen",
"search.filters.create": "Suchfilter erstellen",
Expand Down
2 changes: 1 addition & 1 deletion src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"splashscreen.noTodosAvailable.text": "No todos in this file",
"splashscreen.noTodosAvailable.create": "Create a todo",
"splashscreen.noTodosVisible.text": "No results visible.",
"splashscreen.noTodosVisible.reset": "Reset filters and search",
"splashscreen.noTodosVisible.reset": "Reset filters",
"search.visibleTodos": "Visible todos: ",
"search.addAsTodo": "Add as todo",
"search.filters.create": "Create search filter",
Expand Down
2 changes: 1 addition & 1 deletion src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"splashscreen.noTodosAvailable.text": "Aucune tâche dans ce fichier",
"splashscreen.noTodosAvailable.create": "Créer une tâche",
"splashscreen.noTodosVisible.text": "Aucun résultat visible.",
"splashscreen.noTodosVisible.reset": "Réinitialiser les filtres et la recherche",
"splashscreen.noTodosVisible.reset": "Réinitialiser les filtres",
"search.visibleTodos": "Tâches visibles : ",
"search.addAsTodo": "Ajouter en tant que tâche",
"search.filters.create": "Créer un filtre de recherche",
Expand Down
2 changes: 1 addition & 1 deletion src/locales/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"splashscreen.noTodosAvailable.text": "इस फ़ाइल में कोई कार्य नहीं हैं",
"splashscreen.noTodosAvailable.create": "कार्य बनाएं",
"splashscreen.noTodosVisible.text": "कोई दिखाई देने वाला परिणाम नहीं है।",
"splashscreen.noTodosVisible.reset": "फ़िल्टर और खोज को रीसेट करें",
"splashscreen.noTodosVisible.reset": "फ़िल्टर रीसेट करें",
"search.visibleTodos": "दिखाई देने वाले कार्य: ",
"search.addAsTodo": "काम के रूप में जोड़ें",
"search.filters.create": "खोज फ़िल्टर बनाएं",
Expand Down
2 changes: 1 addition & 1 deletion src/locales/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"splashscreen.noTodosAvailable.text": "Nincsenek feladatok ebben a fájlban",
"splashscreen.noTodosAvailable.create": "Feladat létrehozása",
"splashscreen.noTodosVisible.text": "Nincs látható eredmény.",
"splashscreen.noTodosVisible.reset": "Szűrők és keresés visszaállítása",
"splashscreen.noTodosVisible.reset": "Szűrők visszaállítása",
"search.visibleTodos": "Látható feladatok: ",
"search.addAsTodo": "Hozzáadás feladatként",
"search.filters.create": "Keresési szűrő létrehozása",
Expand Down
2 changes: 1 addition & 1 deletion src/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"splashscreen.noTodosAvailable.text": "Nessun compito in questo file",
"splashscreen.noTodosAvailable.create": "Crea un compito",
"splashscreen.noTodosVisible.text": "Nessun risultato visibile.",
"splashscreen.noTodosVisible.reset": "Reimposta filtri e ricerca",
"splashscreen.noTodosVisible.reset": "Reimposta filtri",
"search.visibleTodos": "Compiti visibili: ",
"search.addAsTodo": "Aggiungi come attività",
"search.filters.create": "Crea filtro di ricerca",
Expand Down
2 changes: 1 addition & 1 deletion src/locales/jp.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"splashscreen.noTodosAvailable.text": "このファイルにはタスクがありません",
"splashscreen.noTodosAvailable.create": "タスクを作成",
"splashscreen.noTodosVisible.text": "表示できる結果はありません。",
"splashscreen.noTodosVisible.reset": "フィルターと検索をリセット",
"splashscreen.noTodosVisible.reset": "フィルターをリセット",
"search.visibleTodos": "表示されるタスク:",
"search.addAsTodo": "タスクとして追加",
"search.filters.create": "検索フィルターを作成する",
Expand Down
2 changes: 1 addition & 1 deletion src/locales/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"splashscreen.noTodosAvailable.text": "이 파일에 작업이 없습니다",
"splashscreen.noTodosAvailable.create": "작업 생성",
"splashscreen.noTodosVisible.text": "표시할 결과 없음.",
"splashscreen.noTodosVisible.reset": "필터 및 검색 재설정",
"splashscreen.noTodosVisible.reset": "필터 초기화",
"search.visibleTodos": "표시된 작업: ",
"search.addAsTodo": "할 일로 추가",
"search.filters.create": "검색 필터 생성",
Expand Down
2 changes: 1 addition & 1 deletion src/locales/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"splashscreen.noTodosAvailable.text": "Brak zadań w tym pliku",
"splashscreen.noTodosAvailable.create": "Utwórz zadanie",
"splashscreen.noTodosVisible.text": "Brak widocznych wyników.",
"splashscreen.noTodosVisible.reset": "Resetuj filtry i wyszukiwanie",
"splashscreen.noTodosVisible.reset": "Resetuj filtry",
"search.visibleTodos": "Widoczne zadania: ",
"search.addAsTodo": "Dodaj jako zadanie",
"search.filters.create": "Utwórz filtr wyszukiwania",
Expand Down
2 changes: 1 addition & 1 deletion src/locales/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"splashscreen.noTodosAvailable.text": "Sem tarefas neste ficheiro",
"splashscreen.noTodosAvailable.create": "Criar uma tarefa",
"splashscreen.noTodosVisible.text": "Sem resultados visíveis.",
"splashscreen.noTodosVisible.reset": "Repor filtros e pesquisa",
"splashscreen.noTodosVisible.reset": "Repor filtros",
"search.visibleTodos": "Tarefas visíveis: ",
"search.addAsTodo": "Adicionar como tarefa",
"search.filters.create": "Criar filtro de pesquisa",
Expand Down
2 changes: 1 addition & 1 deletion src/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"splashscreen.noTodosAvailable.text": "Нет задач в этом файле",
"splashscreen.noTodosAvailable.create": "Создать задачу",
"splashscreen.noTodosVisible.text": "Нет видимых результатов.",
"splashscreen.noTodosVisible.reset": "Сбросить фильтры и поиск",
"splashscreen.noTodosVisible.reset": "Сбросить фильтры",
"search.visibleTodos": "Видимые задачи: ",
"search.addAsTodo": "Добавить как задачу",
"search.filters.create": "Создать фильтр поиска",
Expand Down
2 changes: 1 addition & 1 deletion src/locales/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"splashscreen.noTodosAvailable.text": "Bu dosyada görev yok",
"splashscreen.noTodosAvailable.create": "Görev oluştur",
"splashscreen.noTodosVisible.text": "Görünen sonuç yok.",
"splashscreen.noTodosVisible.reset": "Filtreleri ve aramayı sıfırla",
"splashscreen.noTodosVisible.reset": "Filtreleri sıfırla",
"search.visibleTodos": "Görünür görevler: ",
"search.addAsTodo": "Görev olarak ekle",
"search.filters.create": "Arama filtresi oluştur",
Expand Down
2 changes: 1 addition & 1 deletion src/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"splashscreen.noTodosAvailable.text": "此文件中没有任务",
"splashscreen.noTodosAvailable.create": "创建任务",
"splashscreen.noTodosVisible.text": "没有可见的结果。",
"splashscreen.noTodosVisible.reset": "重置过滤器和搜索",
"splashscreen.noTodosVisible.reset": "重置过滤器",
"search.visibleTodos": "可见任务:",
"search.addAsTodo": "添加为任务",
"search.filters.create": "创建搜索过滤器",
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/Drawer/Attributes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
opacity: 0.5;
text-align: center;
}
h3 {
h2 {
font-weight: bold;
padding: 0;
margin: 0;
Expand Down
8 changes: 8 additions & 0 deletions src/renderer/Drawer/Drawer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
font-size: 0.85em;
text-transform: none;
white-space: nowrap;
.reset {
width: 1em;
height: 1em;
position: absolute;
right: 0em;
bottom: 0em;
color: Variables.$blue;
}
}
}
.MuiTabs-indicator {
Expand Down
20 changes: 18 additions & 2 deletions src/renderer/Drawer/Drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ import React, { useState, useRef, useEffect, memo } from 'react';
import Drawer from '@mui/material/Drawer';
import Tabs from '@mui/material/Tabs';
import Tab from '@mui/material/Tab';
import Badge from '@mui/material/Badge';
import DrawerAttributes from './Attributes';
import DrawerSorting from './Sorting';
import DrawerFilters from './Filters';
import { handleReset } from '../Shared';
import FilterAltIcon from '@mui/icons-material/FilterAlt';
import FilterListIcon from '@mui/icons-material/FilterList';
import RemoveCircleIcon from '@mui/icons-material/RemoveCircle';
import TuneIcon from '@mui/icons-material/Tune';
import { withTranslation, WithTranslation } from 'react-i18next';
import { i18n } from '../Settings/LanguageSelector';
Expand Down Expand Up @@ -82,8 +85,21 @@ const DrawerComponent: React.FC<Props> = memo(({
style={{ width: drawerWidth, marginLeft: -drawerWidth }}
>
<div className="drawerHandle" onMouseDown={handleMouseDown} />
<Tabs className="tabs" centered value={activeTab} onChange={handleTabChange}>
<Tab tabIndex={0} label={t('drawer.tabs.attributes')} value="attributes" icon={<FilterAltIcon />} data-testid={'drawer-tab-attributes'} />
<Tabs className="tabs" centered value={activeTab} onChange={handleTabChange}>
<Tab
tabIndex={0}
label={
<>
{t('drawer.tabs.attributes')}
{Object.values(filters).some(array => Array.isArray(array) && array.length > 0) && (
<RemoveCircleIcon onClick={handleReset} className="reset" />
)}
</>
}
value="attributes"
icon={<FilterAltIcon />}
data-testid={'drawer-tab-attributes'}
/>
<Tab tabIndex={0} label={t('drawer.tabs.filters')} value="filters" icon={<TuneIcon />} data-testid={'drawer-tab-filters'} />
<Tab tabIndex={0} label={t('drawer.tabs.sorting')} value="sorting" icon={<FilterListIcon />} data-testid={'drawer-tab-sorting'} />
</Tabs>
Expand Down
5 changes: 4 additions & 1 deletion src/renderer/Header/Header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
height: 3em;
position: fixed;
top: 0;
right: 1em;
right: 0;
z-index: 9;
display: flex;
justify-content: center;
align-items: center;
padding: 0 1em;
background: #fff;
svg {
display: flex;
cursor: pointer;
Expand All @@ -26,6 +28,7 @@

.darkTheme {
#ToolBar {
background: #212224;
svg {
color: Variables.$mid-grey;
&.active {
Expand Down
4 changes: 4 additions & 0 deletions src/renderer/Shared.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ export const handleFilterSelect = (key: string, name: string, values: string | s
}
};

export const handleReset = () => {
store.setFilters('attributes', []);
};


export const handleLinkClick = (event: MouseEvent, url: string) => {
event.preventDefault();
Expand Down
6 changes: 1 addition & 5 deletions src/renderer/SplashScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import DryCleaningIcon from '@mui/icons-material/DryCleaning';
import BeachAccessIcon from '@mui/icons-material/BeachAccess';
import SaveAltIcon from '@mui/icons-material/SaveAlt';
import { withTranslation, WithTranslation } from 'react-i18next';
import { handleReset } from './Shared';
import './SplashScreen.scss';
import { i18n } from './Settings/LanguageSelector';

Expand All @@ -28,11 +29,6 @@ const SplashScreen: FC<SplashScreenProps> = memo(({
setDialogOpen(true);
};

const handleReset = () => {
store.setFilters('attributes', []);
setSearchString('');
};

const handleOpenFile = () => {
ipcRenderer.send('openFile', false);
};
Expand Down

0 comments on commit 958b7b6

Please sign in to comment.