From ac988f28f478d75e8ff880e8497029810839a93b Mon Sep 17 00:00:00 2001 From: stacksmash76 <98354295+stacksmash76@users.noreply.github.com> Date: Fri, 14 Oct 2022 21:54:21 +0200 Subject: [PATCH] feat(web): better tooltips and uniformity (#474) * - fix: changed all {text,bg}-{teal,indigo}-* color properties to {text,bg}-{blue}-* so there is only one dominant primary color in the UI -- blue - enhancement: added `cursor: pointer` to the PageButton component (used in pagination) - enhancement: modified TitleCell to use the new Tooltip component and modified the width selectors to a more sane default value, now instead of scrolling one just has to tap the cell to see it's untruncated value - enhancement: modified the Tooltip component to use react-popper-tooltip (which in turn uses popper.js) which is a much better alternative, since it uses auto-positioning in case there's not enough space and some things aren't as broken as in the previous version (e.g. there was a problem with forcing the previous tooltip to use a specific width) - enhancement: added a useMedia hook selector from the react-use repository, which might come in handy in the future for better/easier decoupling of Desktop and Mobile UI/UX patterns via JS (versus CSS-only) - enhancement: made the mobile navbar more visible and clear. also fixed previous path === "/" bug which was fixed on desktop. - fix: fixed table headers/footers so they're rounded - enhancement: made pagination components more compact (buttons and show N result selector) * changed {ring, border}-indigo-* to ring-blue-* * build: add yarn.lock * fix: formatting warnings * fix: formatting warnings * fix: more formatting warnings * fix: more formatting --- web/package.json | 1 + web/src/components/Checkbox.tsx | 2 +- web/src/components/data-table/Buttons.tsx | 2 +- web/src/components/data-table/Cells.tsx | 116 ++++++++++++++---- web/src/components/emptystates/index.tsx | 4 +- web/src/components/fields/text.tsx | 2 +- web/src/components/inputs/input.tsx | 8 +- web/src/components/inputs/input_wide.tsx | 8 +- web/src/components/inputs/radio.tsx | 4 +- web/src/components/inputs/select.tsx | 18 +-- web/src/components/inputs/switch.tsx | 14 +-- web/src/components/inputs/text.tsx | 4 +- web/src/components/modals/index.tsx | 2 +- web/src/components/notifications/Toast.tsx | 2 +- web/src/components/panels/index.tsx | 8 +- web/src/components/tooltips/Tooltip.tsx | 68 ++++++++-- web/src/forms/filters/FilterAddForm.tsx | 8 +- web/src/forms/settings/APIKeyAddForm.tsx | 8 +- .../forms/settings/DownloadClientForms.tsx | 10 +- web/src/forms/settings/IndexerForms.tsx | 8 +- web/src/forms/settings/IrcForms.tsx | 26 ++-- web/src/forms/settings/NotificationForms.tsx | 36 +++--- web/src/hooks/hooks.ts | 49 +++++++- web/src/screens/Base.tsx | 15 ++- web/src/screens/Logs.tsx | 23 ++-- web/src/screens/Settings.tsx | 8 +- web/src/screens/auth/login.tsx | 2 +- web/src/screens/auth/onboarding.tsx | 4 +- web/src/screens/dashboard/ActivityTable.tsx | 6 +- web/src/screens/filters/action.tsx | 6 +- web/src/screens/filters/details.tsx | 30 ++--- web/src/screens/filters/list.tsx | 93 +++++++------- web/src/screens/releases/Filters.tsx | 20 +-- web/src/screens/releases/ReleaseTable.tsx | 20 +-- web/src/screens/settings/Action.tsx | 2 +- web/src/screens/settings/Api.tsx | 26 ++-- web/src/screens/settings/DownloadClient.tsx | 17 +-- web/src/screens/settings/Feed.tsx | 28 ++--- web/src/screens/settings/Indexer.tsx | 6 +- web/src/screens/settings/Irc.tsx | 2 +- web/src/screens/settings/Notifications.tsx | 6 +- web/tailwind.config.js | 64 +++++----- web/yarn.lock | 63 +++++++++- 43 files changed, 531 insertions(+), 318 deletions(-) diff --git a/web/package.json b/web/package.json index 877b986..e41076a 100644 --- a/web/package.json +++ b/web/package.json @@ -20,6 +20,7 @@ "react-hook-form": "^7.32.1", "react-hot-toast": "^2.2.0", "react-multi-select-component": "^4.2.9", + "react-popper-tooltip": "^4.4.2", "react-query": "^3.39.1", "react-ridge-state": "4.2.2", "react-router-dom": "^6.3.0", diff --git a/web/src/components/Checkbox.tsx b/web/src/components/Checkbox.tsx index 06eff43..f8fbaa2 100644 --- a/web/src/components/Checkbox.tsx +++ b/web/src/components/Checkbox.tsx @@ -23,7 +23,7 @@ export const Checkbox = ({ label, description, value, setValue }: CheckboxProps) checked={value} onChange={setValue} className={ - `${value ? "bg-teal-500 dark:bg-blue-500" : "bg-gray-200 dark:bg-gray-700" + `${value ? "bg-blue-500" : "bg-gray-200 dark:bg-gray-700" } ml-4 relative inline-flex flex-shrink-0 h-6 w-11 border-2 border-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500`} > ( export const TitleCell = ({ value }: CellProps) => (
- {value} + + + {value} + +
); @@ -32,27 +41,87 @@ interface ReleaseStatusCellProps { interface StatusCellMapEntry { colors: string; icon: React.ReactElement; + textFormatter: (text: string) => React.ReactElement; } const StatusCellMap: Record = { "PUSH_ERROR": { colors: "bg-pink-100 text-pink-800 hover:bg-pink-300", - icon: