From fa4ebdd9d9fd3bc63347891049b4d07ca1269ecb Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Fri, 30 Jun 2023 00:16:41 +0200 Subject: [PATCH] frontend: use more css modules; small fixes --- backend/trcustoms/utils.py | 1 - frontend/src/App.css | 38 ----- frontend/src/App.tsx | 1 - .../common/AuditLogSearch/index.tsx | 18 ++- .../components/common/AuditLogTable/index.css | 37 ----- .../common/AuditLogTable/index.module.css | 26 ++++ .../components/common/AuditLogTable/index.tsx | 26 ++-- .../Checkbox/{index.css => index.module.css} | 10 +- .../src/components/common/Checkbox/index.tsx | 8 +- .../DataList/{index.css => index.module.css} | 2 +- .../src/components/common/DataList/index.tsx | 49 +++--- .../src/components/common/DataTable/index.css | 30 ---- .../common/DataTable/index.module.css | 19 +++ .../src/components/common/DataTable/index.tsx | 49 +++--- .../common/DefinitionList/index.css | 41 ----- .../common/DefinitionList/index.module.css | 35 +++++ .../common/DefinitionList/index.tsx | 13 +- .../EntitiesCheckboxes/index.module.css | 5 + .../common/EntitiesCheckboxes/index.tsx | 25 +-- .../FilePicker/Preview/index.module.css | 3 + .../common/FilePicker/Preview/index.tsx | 83 ++++++++++ .../FilePicker/ReorderTarget/index.module.css | 28 ++++ .../common/FilePicker/ReorderTarget/index.tsx | 62 ++++++++ .../components/common/FilePicker/index.css | 66 -------- .../common/FilePicker/index.module.css | 37 +++++ .../components/common/FilePicker/index.tsx | 146 +----------------- .../{index.css => index.module.css} | 2 +- .../common/FilterCheckboxesHeader/index.tsx | 4 +- .../common/FormGrid/index.module.css | 3 - .../src/components/common/FormGrid/index.tsx | 7 +- .../components/common/GenreSearch/index.tsx | 2 +- .../components/common/GenresTable/index.css | 8 - .../common/GenresTable/index.module.css | 8 + .../components/common/GenresTable/index.tsx | 6 +- .../{index.css => index.module.css} | 9 +- .../components/common/InfoMessage/index.tsx | 8 +- .../LevelList/{index.css => index.module.css} | 26 ++-- .../src/components/common/LevelList/index.tsx | 17 +- .../{index.css => index.module.css} | 6 +- .../components/common/LevelRating/index.tsx | 10 +- .../LevelSearchSidebar/index.module.css | 16 +- .../common/LevelSearchSidebar/index.tsx | 14 +- .../components/common/LevelSidebar/index.tsx | 2 +- .../components/common/Logo/index.module.css | 4 + frontend/src/components/common/Logo/index.tsx | 4 +- .../common/MediumThumbnails/index.tsx | 8 +- .../NavBar/{index.css => index.module.css} | 36 ++--- .../src/components/common/NavBar/index.tsx | 55 ++++--- .../LegaleseItem/index.module.css | 32 ++++ .../NestedLegalese/LegaleseItem/index.tsx | 71 +++++++++ .../NestedLegalese/LegaleseTOCItem/index.tsx | 31 ++++ .../common/NestedLegalese/index.css | 48 ------ .../common/NestedLegalese/index.module.css | 15 ++ .../common/NestedLegalese/index.tsx | 105 ++----------- .../{index.css => index.module.css} | 6 +- .../components/common/PicturePicker/index.tsx | 8 +- .../{index.css => index.module.css} | 7 +- .../components/common/ProgressBar/index.tsx | 8 +- .../components/common/ReviewForm/index.css | 7 - .../components/common/ReviewForm/index.tsx | 8 +- .../common/ReviewSearchSidebar/index.tsx | 2 +- .../{index.css => index.module.css} | 32 ++-- .../components/common/ReviewStats/index.tsx | 20 +-- .../{index.css => index.module.css} | 32 ++-- .../components/common/ReviewsList/index.tsx | 29 ++-- .../Section/{index.css => index.module.css} | 8 +- .../src/components/common/Section/index.tsx | 12 +- .../SortLink/{index.css => index.module.css} | 6 +- .../src/components/common/SortLink/index.tsx | 6 +- .../TabSwitch/{index.css => index.module.css} | 24 +-- .../src/components/common/TabSwitch/index.tsx | 20 +-- .../src/components/common/TagSearch/index.tsx | 2 +- .../common/TagsTable/index.module.css | 8 +- .../src/components/common/TagsTable/index.tsx | 4 +- .../{index.css => index.module.css} | 16 +- .../components/common/UserFancyList/index.tsx | 19 ++- .../src/components/common/UserForm/index.tsx | 2 +- .../src/components/common/UserList/index.css | 14 -- .../common/UserList/index.module.css | 14 ++ .../src/components/common/UserList/index.tsx | 4 +- .../common/WalkthroughForm/index.tsx | 2 +- .../{index.css => index.module.css} | 24 +-- .../common/WalkthroughStats/index.tsx | 22 ++- .../common/WalkthroughsTable/index.tsx | 1 - .../formfields/GenresFormField/index.css | 22 --- .../GenresFormField/index.module.css | 18 +++ .../formfields/GenresFormField/index.tsx | 8 +- .../formfields/TextAreaFormField/index.css | 66 -------- .../TextAreaFormField/index.module.css | 59 +++++++ .../formfields/TextAreaFormField/index.tsx | 22 ++- .../layouts/SidebarLayout/index.module.css | 6 +- .../{index.css => index.module.css} | 20 ++- .../MarkdownAttachmentStrip/index.tsx | 8 +- .../Markdown/{index.css => index.module.css} | 30 ++-- .../components/markdown/Markdown/index.tsx | 26 ++-- .../src/components/pages/AboutPage/index.tsx | 2 +- .../components/pages/GenreListPage/index.tsx | 10 +- .../HomePage/FeaturedLevels/index.module.css | 4 - .../pages/HomePage/FeaturedLevels/index.tsx | 4 +- .../pages/HomePage/StatsSidebar/index.tsx | 10 +- .../components/pages/LevelListPage/index.css | 37 ----- .../pages/LevelListPage/index.module.css | 10 ++ .../components/pages/LevelListPage/index.tsx | 32 ++-- .../components/pages/ModerationPage/index.css | 27 ---- .../components/pages/ModerationPage/index.tsx | 1 - .../pages/ReviewAuthorsPage/index.tsx | 2 +- .../ReviewLevelSuggestionsPage/index.tsx | 2 +- .../components/pages/ReviewListPage/index.tsx | 2 +- .../components/pages/TagListPage/index.tsx | 10 +- .../pages/TermsAndConditionsPage/index.tsx | 2 +- .../components/pages/TrophiesPage/index.tsx | 1 + .../pages/UserWalkthroughsPage/index.tsx | 2 +- .../pages/WalkthroughEditPage/index.css | 3 - .../WalkthroughEditPage/index.module.css | 3 + .../pages/WalkthroughEditPage/index.tsx | 41 ++--- 115 files changed, 1095 insertions(+), 1177 deletions(-) delete mode 100644 frontend/src/App.css delete mode 100644 frontend/src/components/common/AuditLogTable/index.css create mode 100644 frontend/src/components/common/AuditLogTable/index.module.css rename frontend/src/components/common/Checkbox/{index.css => index.module.css} (86%) rename frontend/src/components/common/DataList/{index.css => index.module.css} (56%) delete mode 100644 frontend/src/components/common/DataTable/index.css create mode 100644 frontend/src/components/common/DataTable/index.module.css delete mode 100644 frontend/src/components/common/DefinitionList/index.css create mode 100644 frontend/src/components/common/DefinitionList/index.module.css create mode 100644 frontend/src/components/common/EntitiesCheckboxes/index.module.css create mode 100644 frontend/src/components/common/FilePicker/Preview/index.module.css create mode 100644 frontend/src/components/common/FilePicker/Preview/index.tsx create mode 100644 frontend/src/components/common/FilePicker/ReorderTarget/index.module.css create mode 100644 frontend/src/components/common/FilePicker/ReorderTarget/index.tsx delete mode 100644 frontend/src/components/common/FilePicker/index.css create mode 100644 frontend/src/components/common/FilePicker/index.module.css rename frontend/src/components/common/FilterCheckboxesHeader/{index.css => index.module.css} (73%) delete mode 100644 frontend/src/components/common/GenresTable/index.css create mode 100644 frontend/src/components/common/GenresTable/index.module.css rename frontend/src/components/common/InfoMessage/{index.css => index.module.css} (84%) rename frontend/src/components/common/LevelList/{index.css => index.module.css} (65%) rename frontend/src/components/common/LevelRating/{index.css => index.module.css} (60%) create mode 100644 frontend/src/components/common/Logo/index.module.css rename frontend/src/components/common/NavBar/{index.css => index.module.css} (72%) create mode 100644 frontend/src/components/common/NestedLegalese/LegaleseItem/index.module.css create mode 100644 frontend/src/components/common/NestedLegalese/LegaleseItem/index.tsx create mode 100644 frontend/src/components/common/NestedLegalese/LegaleseTOCItem/index.tsx delete mode 100644 frontend/src/components/common/NestedLegalese/index.css create mode 100644 frontend/src/components/common/NestedLegalese/index.module.css rename frontend/src/components/common/PicturePicker/{index.css => index.module.css} (52%) rename frontend/src/components/common/ProgressBar/{index.css => index.module.css} (78%) delete mode 100644 frontend/src/components/common/ReviewForm/index.css rename frontend/src/components/common/ReviewStats/{index.css => index.module.css} (72%) rename frontend/src/components/common/ReviewsList/{index.css => index.module.css} (75%) rename frontend/src/components/common/Section/{index.css => index.module.css} (67%) rename frontend/src/components/common/SortLink/{index.css => index.module.css} (55%) rename frontend/src/components/common/TabSwitch/{index.css => index.module.css} (60%) rename frontend/src/components/common/UserFancyList/{index.css => index.module.css} (63%) delete mode 100644 frontend/src/components/common/UserList/index.css create mode 100644 frontend/src/components/common/UserList/index.module.css rename frontend/src/components/common/WalkthroughStats/{index.css => index.module.css} (69%) delete mode 100644 frontend/src/components/formfields/GenresFormField/index.css create mode 100644 frontend/src/components/formfields/GenresFormField/index.module.css delete mode 100644 frontend/src/components/formfields/TextAreaFormField/index.css create mode 100644 frontend/src/components/formfields/TextAreaFormField/index.module.css rename frontend/src/components/markdown-composer/MarkdownAttachmentStrip/{index.css => index.module.css} (50%) rename frontend/src/components/markdown/Markdown/{index.css => index.module.css} (53%) delete mode 100644 frontend/src/components/pages/LevelListPage/index.css create mode 100644 frontend/src/components/pages/LevelListPage/index.module.css delete mode 100644 frontend/src/components/pages/ModerationPage/index.css delete mode 100644 frontend/src/components/pages/WalkthroughEditPage/index.css create mode 100644 frontend/src/components/pages/WalkthroughEditPage/index.module.css diff --git a/backend/trcustoms/utils.py b/backend/trcustoms/utils.py index bb00547c..f00d35ba 100644 --- a/backend/trcustoms/utils.py +++ b/backend/trcustoms/utils.py @@ -101,7 +101,6 @@ def parse_date_range( ) -> tuple[datetime | None, datetime | None] | None: date_min: datetime | None = None date_max: datetime | None = None - print("source", source, flush=1) if source and ( match := re.match(r"^(?P\d{4})(?:-(?P\d{1,2}))?$", source) ): diff --git a/frontend/src/App.css b/frontend/src/App.css deleted file mode 100644 index 74b5e053..00000000 --- a/frontend/src/App.css +++ /dev/null @@ -1,38 +0,0 @@ -.App { - text-align: center; -} - -.App-logo { - height: 40vmin; - pointer-events: none; -} - -@media (prefers-reduced-motion: no-preference) { - .App-logo { - animation: App-logo-spin infinite 20s linear; - } -} - -.App-header { - background-color: #282c34; - min-height: 100vh; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - font-size: calc(10px + 2vmin); - color: white; -} - -.App-link { - color: #61dafb; -} - -@keyframes App-logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -} diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index b7549c3e..d4d6b188 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -1,4 +1,3 @@ -import "./App.css"; import "./themes.css"; import { useEffect } from "react"; import { Routes } from "react-router-dom"; diff --git a/frontend/src/components/common/AuditLogSearch/index.tsx b/frontend/src/components/common/AuditLogSearch/index.tsx index 4ec4f972..ecf9c52a 100644 --- a/frontend/src/components/common/AuditLogSearch/index.tsx +++ b/frontend/src/components/common/AuditLogSearch/index.tsx @@ -239,14 +239,16 @@ const AuditLogSearch = ({ > {({ submitForm, resetForm }) => (
- - Search filter - handleClear(resetForm)} - > - (reset) - + + + Search filter + handleClear(resetForm)} + > + (reset) + +
diff --git a/frontend/src/components/common/AuditLogTable/index.css b/frontend/src/components/common/AuditLogTable/index.css deleted file mode 100644 index cd0c165d..00000000 --- a/frontend/src/components/common/AuditLogTable/index.css +++ /dev/null @@ -1,37 +0,0 @@ -.AuditLogTable .DataTable--row td { - border-bottom: 1px solid var(--label-bg-color); -} -.AuditLogTable--changeList { - list-style-type: none; - display: inline-block; - margin: 0; - padding: 0; -} -.AuditLogTable--changeListItem { - display: block; - margin: 0; - padding: 0; -} - -.AuditLogTable--created, -.AuditLogTable--author { - white-space: nowrap; - width: 10%; -} - -.AuditLogTable--object { - width: 40%; -} -.AuditLogTable--changes { - width: 40%; -} - -.AuditLogTable--changesWrapper { - display: flex; - align-items: flex-start; - justify-content: space-between; - gap: 0 0.5rem; -} -.AuditLogTable--requiresAction { - white-space: nowrap; -} diff --git a/frontend/src/components/common/AuditLogTable/index.module.css b/frontend/src/components/common/AuditLogTable/index.module.css new file mode 100644 index 00000000..8afdd758 --- /dev/null +++ b/frontend/src/components/common/AuditLogTable/index.module.css @@ -0,0 +1,26 @@ +.table :global td { + border-bottom: 1px solid var(--label-bg-color); +} + +.table :global .created, +.table :global .author { + white-space: nowrap; + width: 10%; +} + +.table :global .object { + width: 40%; +} +.table :global .changes { + width: 40%; +} + +.changesWrapper { + display: flex; + align-items: flex-start; + justify-content: space-between; + gap: 0 0.5rem; +} +.requiresAction { + white-space: nowrap; +} diff --git a/frontend/src/components/common/AuditLogTable/index.tsx b/frontend/src/components/common/AuditLogTable/index.tsx index de8b064b..82d7f5e7 100644 --- a/frontend/src/components/common/AuditLogTable/index.tsx +++ b/frontend/src/components/common/AuditLogTable/index.tsx @@ -1,4 +1,4 @@ -import "./index.css"; +import styles from "./index.module.css"; import { useQuery } from "react-query"; import type { DataTableColumn } from "src/components/common/DataTable"; import { DataTable } from "src/components/common/DataTable"; @@ -192,10 +192,10 @@ const AuditLogTable = ({ name: "changes", label: "Changes", itemElement: ({ item }) => ( - + {item.changes.join(" ")} {item.is_action_required && ( - + Requires action )} @@ -207,17 +207,15 @@ const AuditLogTable = ({ const itemKey = (auditLog: AuditLogListing) => `${auditLog.id}`; return ( -
- -
+ ); }; diff --git a/frontend/src/components/common/Checkbox/index.css b/frontend/src/components/common/Checkbox/index.module.css similarity index 86% rename from frontend/src/components/common/Checkbox/index.css rename to frontend/src/components/common/Checkbox/index.module.css index 24f9dc9e..706b8e9d 100644 --- a/frontend/src/components/common/Checkbox/index.css +++ b/frontend/src/components/common/Checkbox/index.module.css @@ -1,8 +1,8 @@ -.Checkbox--label { +.label { cursor: pointer; } -.Checkbox--input { +.input { position: relative; cursor: pointer; width: 20px; @@ -12,7 +12,7 @@ margin: 0 0.5rem 0 0; display: inline-flex; } -.Checkbox--input:before { +.input:before { content: ""; display: block; position: absolute; @@ -25,7 +25,7 @@ color: var(--input-fg-color); box-sizing: border-box; } -.Checkbox--input:checked:before { +.input:checked:before { content: ""; display: block; position: absolute; @@ -36,7 +36,7 @@ border-color: var(--button-bg-color); background-color: var(--button-bg-color); } -.Checkbox--input:checked:after { +.input:checked:after { content: ""; display: block; width: 30%; diff --git a/frontend/src/components/common/Checkbox/index.tsx b/frontend/src/components/common/Checkbox/index.tsx index 6c6b0cff..8099dd91 100644 --- a/frontend/src/components/common/Checkbox/index.tsx +++ b/frontend/src/components/common/Checkbox/index.tsx @@ -1,4 +1,4 @@ -import "./index.css"; +import styles from "./index.module.css"; interface CheckboxProps { label: string | React.ReactNode; @@ -9,9 +9,9 @@ interface CheckboxProps { const Checkbox = ({ label, ...props }: CheckboxProps) => { return ( -
-