From 4e1038837b23d2ac5fcafaccb41227c97c94e9e4 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sat, 21 Sep 2024 09:03:20 -0400 Subject: [PATCH] chore: Remove old feature flag fix: Loading jank when creating new collection Add italic prop to Text component --- app/components/Collection/CollectionForm.tsx | 23 +- app/components/Collection/CollectionNew.tsx | 9 +- app/components/DocumentMeta.tsx | 2 +- .../components/CollectionLinkChildren.tsx | 21 +- .../components/EmptyCollectionPlaceholder.tsx | 22 -- .../Sidebar/components/StarredLink.tsx | 2 +- app/components/Text.ts | 4 + app/models/Collection.ts | 80 ++---- app/scenes/Collection/components/Empty.tsx | 78 ++---- .../components/MembershipPreview.tsx | 7 - app/scenes/Collection/index.tsx | 256 ++++++++---------- app/scenes/Document/components/References.tsx | 2 +- app/scenes/DocumentDelete.tsx | 2 +- shared/i18n/locales/en_US/translation.json | 7 +- 14 files changed, 203 insertions(+), 312 deletions(-) delete mode 100644 app/components/Sidebar/components/EmptyCollectionPlaceholder.tsx diff --git a/app/components/Collection/CollectionForm.tsx b/app/components/Collection/CollectionForm.tsx index 72af44c1be..28b31c31f6 100644 --- a/app/components/Collection/CollectionForm.tsx +++ b/app/components/Collection/CollectionForm.tsx @@ -19,7 +19,6 @@ import Text from "~/components/Text"; import useBoolean from "~/hooks/useBoolean"; import useCurrentTeam from "~/hooks/useCurrentTeam"; import { EmptySelectValue } from "~/types"; -import { Feature, FeatureFlags } from "~/utils/FeatureFlags"; const IconPicker = React.lazy(() => import("~/components/IconPicker")); @@ -156,18 +155,16 @@ export const CollectionForm = observer(function CollectionForm_({ /> )} - {team.sharing && - (!collection || - FeatureFlags.isEnabled(Feature.newCollectionSharing)) && ( - - )} + {team.sharing && ( + + )} - - {FeatureFlags.isEnabled(Feature.newCollectionSharing) ? null : ( - - )} - - )} - + values={{ + collectionName, + }} + components={{ + em: , + }} + /> + + + ); } const Centered = styled(Flex)` text-align: center; - margin: 40vh auto 0; - max-width: 380px; - transform: translateY(-50%); -`; - -const Empty = styled(Flex)` + align-items: center; justify-content: center; - margin: 10px 0; - gap: 8px; + margin: 0 auto; + max-width: 380px; + height: 50vh; `; export default observer(EmptyCollection); diff --git a/app/scenes/Collection/components/MembershipPreview.tsx b/app/scenes/Collection/components/MembershipPreview.tsx index ce288e6769..942abf8aea 100644 --- a/app/scenes/Collection/components/MembershipPreview.tsx +++ b/app/scenes/Collection/components/MembershipPreview.tsx @@ -8,11 +8,9 @@ import { Avatar, AvatarSize } from "~/components/Avatar"; import Facepile from "~/components/Facepile"; import Fade from "~/components/Fade"; import NudeButton from "~/components/NudeButton"; -import { editCollectionPermissions } from "~/actions/definitions/collections"; import useActionContext from "~/hooks/useActionContext"; import useMobile from "~/hooks/useMobile"; import useStores from "~/hooks/useStores"; -import { Feature, FeatureFlags } from "~/utils/FeatureFlags"; type Props = { collection: Collection; @@ -71,11 +69,6 @@ const MembershipPreview = ({ collection, limit = 8 }: Props) => { return ( 0 diff --git a/app/scenes/Collection/index.tsx b/app/scenes/Collection/index.tsx index 16576102d8..449014dc93 100644 --- a/app/scenes/Collection/index.tsx +++ b/app/scenes/Collection/index.tsx @@ -17,7 +17,6 @@ import { colorPalette } from "@shared/utils/collections"; import Collection from "~/models/Collection"; import Search from "~/scenes/Search"; import { Action } from "~/components/Actions"; -import Badge from "~/components/Badge"; import CenteredContent from "~/components/CenteredContent"; import CollectionDescription from "~/components/CollectionDescription"; import Heading from "~/components/Heading"; @@ -31,14 +30,12 @@ import PlaceholderText from "~/components/PlaceholderText"; import Scene from "~/components/Scene"; import Tab from "~/components/Tab"; import Tabs from "~/components/Tabs"; -import Tooltip from "~/components/Tooltip"; import { editCollection } from "~/actions/definitions/collections"; import useCommandBarActions from "~/hooks/useCommandBarActions"; import { useLastVisitedPath } from "~/hooks/useLastVisitedPath"; import { usePinnedDocuments } from "~/hooks/usePinnedDocuments"; import usePolicy from "~/hooks/usePolicy"; import useStores from "~/hooks/useStores"; -import { Feature, FeatureFlags } from "~/utils/FeatureFlags"; import { collectionPath, updateCollectionPath } from "~/utils/routeHelpers"; import Actions from "./components/Actions"; import DropToImport from "./components/DropToImport"; @@ -154,8 +151,7 @@ function CollectionScene() { <> - {FeatureFlags.isEnabled(Feature.newCollectionSharing) && - can.update && } + {can.update && } @@ -167,142 +163,124 @@ function CollectionScene() { collectionId={collection.id} > - {collection.isEmpty ? ( - - ) : ( - <> - - - {can.update ? ( - - - - ) : ( - fallbackIcon - )} - - {collection.name} - {collection.isPrivate && - !FeatureFlags.isEnabled(Feature.newCollectionSharing) && ( - - {t("Private")} - - )} - + + + {can.update ? ( + + + + ) : ( + fallbackIcon + )} + + {collection.name} + - - + + - - - - {t("Documents")} - - - {t("Recently updated")} - - - {t("Recently published")} - - - {t("Least recently updated")} - - - {t("A–Z")} - - - - - - - - - - - - - - - - - - - - - - - - - )} + + + + {t("Documents")} + + + {t("Recently updated")} + + + {t("Recently published")} + + + {t("Least recently updated")} + + + {t("A–Z")} + + + {collection.isEmpty ? ( + + ) : ( + + + + + + + + + + + + + + + + + + + + + )} + diff --git a/app/scenes/Document/components/References.tsx b/app/scenes/Document/components/References.tsx index fe507d3678..d9943868e2 100644 --- a/app/scenes/Document/components/References.tsx +++ b/app/scenes/Document/components/References.tsx @@ -27,7 +27,7 @@ function References({ document }: Props) { ? collections.get(document.collectionId) : undefined; const children = collection - ? collection.getDocumentChildren(document.id) + ? collection.getChildrenForDocument(document.id) : []; const showBacklinks = !!backlinks.length; const showChildDocuments = !!children.length; diff --git a/app/scenes/DocumentDelete.tsx b/app/scenes/DocumentDelete.tsx index 70d5525d3f..f5a75cc599 100644 --- a/app/scenes/DocumentDelete.tsx +++ b/app/scenes/DocumentDelete.tsx @@ -31,7 +31,7 @@ function DocumentDelete({ document, onSubmit }: Props) { ? collections.get(document.collectionId) : undefined; const nestedDocumentsCount = collection - ? collection.getDocumentChildren(document.id).length + ? collection.getChildrenForDocument(document.id).length : 0; const handleSubmit = React.useCallback( async (ev: React.SyntheticEvent) => { diff --git a/shared/i18n/locales/en_US/translation.json b/shared/i18n/locales/en_US/translation.json index 8af1661296..cf519fc0b5 100644 --- a/shared/i18n/locales/en_US/translation.json +++ b/shared/i18n/locales/en_US/translation.json @@ -337,9 +337,9 @@ "Move document": "Move document", "New doc": "New doc", "You can't reorder documents in an alphabetically sorted collection": "You can't reorder documents in an alphabetically sorted collection", + "Empty": "Empty", "Collections": "Collections", "Document not supported – try Markdown, Plain text, HTML, or Word": "Document not supported – try Markdown, Plain text, HTML, or Word", - "Empty": "Empty", "Go back": "Go back", "Go forward": "Go forward", "Could not load shared documents": "Could not load shared documents", @@ -541,9 +541,6 @@ "Collection menu": "Collection menu", "Drop documents to import": "Drop documents to import", "{{ collectionName }} doesn’t contain any\n documents yet.": "{{ collectionName }} doesn’t contain any\n documents yet.", - "Get started by creating a new one!": "Get started by creating a new one!", - "Create a document": "Create a document", - "Manage permissions": "Manage permissions", "{{ usersCount }} users and {{ groupsCount }} groups with access": "{{ usersCount }} user and {{ groupsCount }} groups with access", "{{ usersCount }} users and {{ groupsCount }} groups with access_plural": "{{ usersCount }} users and {{ groupsCount }} groups with access", "{{ usersCount }} users and a group have access": "{{ usersCount }} user and a group have access", @@ -553,8 +550,6 @@ "{{ groupsCount }} groups with access": "{{ groupsCount }} group with access", "{{ groupsCount }} groups with access_plural": "{{ groupsCount }} groups with access", "Share": "Share", - "This collection is only visible to those given access": "This collection is only visible to those given access", - "Private": "Private", "Recently updated": "Recently updated", "Recently published": "Recently published", "Least recently updated": "Least recently updated",