Files
outline/app/hooks/useDocumentActiveModels.ts
Tom MoorandClaude Opus 5 0f8f69de42 Unpin and context menu controls on pinned documents (#13498)
* feat: Unpin and context menu controls on pinned documents

- Adds an unpin control to document chips in the collapsed pinned view
- Adds the collapse toggle to collections, matching home
- Makes the Pin menu items toggles with a selected state
- Adds a document context menu to pinned cards and chips
- Stops the drag sensor swallowing clicks on the card unpin button

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: Hide the collection pin toggle for a mixed selection

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-19 23:38:09 -04:00

26 lines
834 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type Document from "~/models/Document";
import type Model from "~/models/base/Model";
import useStores from "~/hooks/useStores";
/**
* Returns the models that document actions should operate on – the document
* itself, and its collection unless the document is only reachable through a
* direct share with the user.
*
* @param document the document the actions will be performed on.
* @returns the active models to provide to the action context.
*/
export function useDocumentActiveModels(document: Document): Model[] {
const { userMemberships, groupMemberships } = useStores();
const isShared = !!(
userMemberships.getByDocumentId(document.id) ||
groupMemberships.getByDocumentId(document.id)
);
return [
document,
...(!isShared && document.collection ? [document.collection] : []),
];
}