-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Update collection sorting & metadata (#2324)
- Fixes #2321 - Resolves #2323 Follows #2327, should be rebased and merged afterwards ## Changes - Refactors dashboard and org profile preview to use private API endpoint, to fix public collections not showing the org visibility is hidden - Enables sorting collections by `dateLatest`, sorts public collections by `dateLatest` by default - Enables sorting collections by page count - Shows collection period (i.e. `dateEarliest` to `dateLatest`) in collections list - Shows same collection metadata in private and public views, updates private view info bar - Fixes "Update Org Profile" action item showing for crawler roles <!-- ## Follow-ups --> --------- Co-authored-by: Tessa Walsh <[email protected]>
- Loading branch information
Showing
15 changed files
with
329 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { msg } from "@lit/localize"; | ||
import { html, type TemplateResult } from "lit"; | ||
import { when } from "lit/directives/when.js"; | ||
|
||
import { monthYearDateRange } from "@/strings/utils"; | ||
import type { Collection, PublicCollection } from "@/types/collection"; | ||
import localize from "@/utils/localize"; | ||
import { pluralOf } from "@/utils/pluralize"; | ||
|
||
export function metadataItemWithCollection( | ||
collection?: Collection | PublicCollection, | ||
) { | ||
return function metadataItem({ | ||
label, | ||
render, | ||
}: { | ||
label: string | TemplateResult; | ||
render: (c: PublicCollection) => TemplateResult | string; | ||
}) { | ||
return html` | ||
<btrix-desc-list-item label=${label}> | ||
${when( | ||
collection, | ||
render, | ||
() => html`<sl-skeleton class="w-full"></sl-skeleton>`, | ||
)} | ||
</btrix-desc-list-item> | ||
`; | ||
}; | ||
} | ||
|
||
export function metadataColumn(collection?: Collection | PublicCollection) { | ||
const metadataItem = metadataItemWithCollection(collection); | ||
|
||
return html` | ||
<btrix-desc-list> | ||
${metadataItem({ | ||
label: msg("Collection Period"), | ||
render: (col) => html` | ||
<span class="font-sans"> | ||
${monthYearDateRange(col.dateEarliest, col.dateLatest)} | ||
</span> | ||
`, | ||
})} | ||
${metadataItem({ | ||
label: msg("Pages in Collection"), | ||
render: (col) => | ||
`${localize.number(col.pageCount)} ${pluralOf("pages", col.pageCount)}`, | ||
})} | ||
${metadataItem({ | ||
label: msg("Total Page Snapshots"), | ||
render: (col) => | ||
`${localize.number(col.snapshotCount)} ${pluralOf("snapshots", col.snapshotCount)}`, | ||
})} | ||
</btrix-desc-list> | ||
`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.