chore: Deprecate collection.url on client

This commit is contained in:
Tom Moor
2024-01-31 20:08:01 -05:00
parent 4800b60825
commit 7417514e7c
11 changed files with 32 additions and 24 deletions

View File

@@ -179,27 +179,27 @@ function CollectionScene() {
<Documents>
<Tabs>
<Tab to={collectionPath(collection.url)} exact>
<Tab to={collectionPath(collection.path)} exact>
{t("Documents")}
</Tab>
<Tab to={collectionPath(collection.url, "updated")} exact>
<Tab to={collectionPath(collection.path, "updated")} exact>
{t("Recently updated")}
</Tab>
<Tab to={collectionPath(collection.url, "published")} exact>
<Tab to={collectionPath(collection.path, "published")} exact>
{t("Recently published")}
</Tab>
<Tab to={collectionPath(collection.url, "old")} exact>
<Tab to={collectionPath(collection.path, "old")} exact>
{t("Least recently updated")}
</Tab>
<Tab
to={collectionPath(collection.url, "alphabetical")}
to={collectionPath(collection.path, "alphabetical")}
exact
>
{t("AZ")}
</Tab>
</Tabs>
<Switch>
<Route path={collectionPath(collection.url, "alphabetical")}>
<Route path={collectionPath(collection.path, "alphabetical")}>
<PaginatedDocumentList
key="alphabetical"
documents={documents.alphabeticalInCollection(
@@ -211,7 +211,7 @@ function CollectionScene() {
}}
/>
</Route>
<Route path={collectionPath(collection.url, "old")}>
<Route path={collectionPath(collection.path, "old")}>
<PaginatedDocumentList
key="old"
documents={documents.leastRecentlyUpdatedInCollection(
@@ -223,12 +223,12 @@ function CollectionScene() {
}}
/>
</Route>
<Route path={collectionPath(collection.url, "recent")}>
<Route path={collectionPath(collection.path, "recent")}>
<Redirect
to={collectionPath(collection.url, "published")}
to={collectionPath(collection.path, "published")}
/>
</Route>
<Route path={collectionPath(collection.url, "published")}>
<Route path={collectionPath(collection.path, "published")}>
<PaginatedDocumentList
key="published"
documents={documents.recentlyPublishedInCollection(
@@ -241,7 +241,7 @@ function CollectionScene() {
showPublished
/>
</Route>
<Route path={collectionPath(collection.url, "updated")}>
<Route path={collectionPath(collection.path, "updated")}>
<PaginatedDocumentList
key="updated"
documents={documents.recentlyUpdatedInCollection(
@@ -253,7 +253,7 @@ function CollectionScene() {
}}
/>
</Route>
<Route path={collectionPath(collection.url)} exact>
<Route path={collectionPath(collection.path)} exact>
<PaginatedDocumentList
documents={documents.rootInCollection(collection.id)}
fetch={documents.fetchPage}

View File

@@ -65,7 +65,7 @@ class CollectionNew extends React.Component<Props> {
try {
await collection.save();
this.props.onSubmit();
history.push(collection.url);
history.push(collection.path);
} catch (err) {
toast.error(err.message);
} finally {

View File

@@ -51,7 +51,7 @@ function DocumentDelete({ document, onSubmit }: Props) {
}
// otherwise, redirect to the collection home
history.push(collectionPath(collection?.url || "/"));
history.push(collectionPath(collection?.path || "/"));
}
onSubmit();