frontend permissions

* rework backend workspace permissions
This commit is contained in:
Philipinho
2024-06-03 02:54:12 +01:00
parent b88e0b605f
commit 886d9591fa
54 changed files with 715 additions and 385 deletions

View File

@ -11,6 +11,7 @@ export interface FullEditorProps {
slugId: string;
title: string;
spaceSlug: string;
editable: boolean;
}
export function FullEditor({
@ -18,6 +19,7 @@ export function FullEditor({
title,
slugId,
spaceSlug,
editable,
}: FullEditorProps) {
return (
<div className={classes.editor}>
@ -26,8 +28,9 @@ export function FullEditor({
slugId={slugId}
title={title}
spaceSlug={spaceSlug}
editable={editable}
/>
<MemoizedPageEditor pageId={pageId} />
<MemoizedPageEditor pageId={pageId} editable={editable} />
</div>
);
}

View File

@ -24,13 +24,10 @@ import { EditorBubbleMenu } from "@/features/editor/components/bubble-menu/bubbl
interface PageEditorProps {
pageId: string;
editable?: boolean;
editable: boolean;
}
export default function PageEditor({
pageId,
editable = true,
}: PageEditorProps) {
export default function PageEditor({ pageId, editable }: PageEditorProps) {
const [token] = useAtom(authTokensAtom);
const collaborationURL = useCollaborationUrl();
const [currentUser] = useAtom(currentUserAtom);

View File

@ -28,6 +28,7 @@ export interface TitleEditorProps {
slugId: string;
title: string;
spaceSlug: string;
editable: boolean;
}
export function TitleEditor({
@ -35,6 +36,7 @@ export function TitleEditor({
slugId,
title,
spaceSlug,
editable,
}: TitleEditorProps) {
const [debouncedTitleState, setDebouncedTitleState] = useState(null);
const [debouncedTitle] = useDebouncedValue(debouncedTitleState, 1000);
@ -57,6 +59,7 @@ export function TitleEditor({
Text,
Placeholder.configure({
placeholder: "Untitled",
showOnlyWhenEditable: false,
}),
History.configure({
depth: 20,
@ -72,6 +75,7 @@ export function TitleEditor({
const currentTitle = editor.getText();
setDebouncedTitleState(currentTitle);
},
editable: editable,
content: title,
});