Skip to content

Commit

Permalink
Fix store name, add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
choidabom committed Dec 11, 2024
1 parent dea6514 commit 9cb6703
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
8 changes: 4 additions & 4 deletions frontend/src/components/editor/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function Editor(props: EditorProps) {
const [element, setElement] = useState<HTMLElement>();
const editorStore = useSelector(selectEditor);
const configStore = useSelector(selectConfig);
const settingStore = useSelector(selectFeatureSetting);
const featureSettingStore = useSelector(selectFeatureSetting);
const workspaceStore = useSelector(selectWorkspace);
const { mutateAsync: createUploadUrl } = useCreateUploadUrlMutation();
const { mutateAsync: uploadFile } = useUploadFileMutation();
Expand All @@ -51,7 +51,7 @@ function Editor(props: EditorProps) {
!element ||
!editorStore.doc ||
!editorStore.client ||
typeof settingStore.fileUpload?.enable !== "boolean"
typeof featureSettingStore.fileUpload?.enable !== "boolean"
) {
return;
}
Expand Down Expand Up @@ -87,7 +87,7 @@ function Editor(props: EditorProps) {
}),
yorkieCodeMirror(editorStore.doc, editorStore.client),
intelligencePivot,
...(settingStore.fileUpload.enable
...(featureSettingStore.fileUpload.enable
? [imageUploader(handleUploadImage, editorStore.doc)]
: []),
urlHyperlinkInserter(editorStore.doc),
Expand All @@ -107,7 +107,7 @@ function Editor(props: EditorProps) {
configStore.codeKey,
themeMode,
workspaceStore.data,
settingStore.fileUpload?.enable,
featureSettingStore.fileUpload?.enable,
dispatch,
createUploadUrl,
uploadFile,
Expand Down
18 changes: 9 additions & 9 deletions frontend/src/components/headers/DocumentHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
import ArrowBackIosNewIcon from "@mui/icons-material/ArrowBackIosNew";
import EditIcon from "@mui/icons-material/Edit";
import MoreVertIcon from "@mui/icons-material/MoreVert";
import VerticalSplitIcon from "@mui/icons-material/VerticalSplit";
import VisibilityIcon from "@mui/icons-material/Visibility";
import {
AppBar,
Grid2 as Grid,
IconButton,
Paper,
Stack,
ToggleButton,
ToggleButtonGroup,
Toolbar,
Tooltip,
Grid2 as Grid,
Typography,
} from "@mui/material";
import { useSnackbar } from "notistack";
import { useEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { useNavigate } from "react-router-dom";
import { useUpdateDocumentTitleMutation } from "../../hooks/api/workspaceDocument";
import { useUserPresence } from "../../hooks/useUserPresence";
import { selectDocument } from "../../store/documentSlice";
import { EditorModeType, selectEditor, setMode } from "../../store/editorSlice";
import { selectWorkspace } from "../../store/workspaceSlice";
import { ShareRole } from "../../utils/share";
import DownloadMenu from "../common/DownloadMenu";
import ShareButton from "../common/ShareButton";
import UserPresenceList from "./UserPresenceList";
import { selectDocument } from "../../store/documentSlice";
import { useUpdateDocumentTitleMutation } from "../../hooks/api/workspaceDocument";
import { useSnackbar } from "notistack";
import DocumentPopover from "../popovers/DocumentPopover";
import MoreVertIcon from "@mui/icons-material/MoreVert";
import UserPresenceList from "./UserPresenceList";

function DocumentHeader() {
const dispatch = useDispatch();
Expand All @@ -43,7 +43,7 @@ function DocumentHeader() {
);
const isEditingDisabled = Boolean(editorState.shareRole);
const { enqueueSnackbar } = useSnackbar();
const [moreButtonanchorEl, setMoreButtonAnchorEl] = useState<HTMLButtonElement | null>(null);
const [moreButtonAnchorEl, setMoreButtonAnchorEl] = useState<HTMLButtonElement | null>(null);

useEffect(() => {
if (editorState.shareRole === ShareRole.READ) {
Expand Down Expand Up @@ -162,8 +162,8 @@ function DocumentHeader() {
<MoreVertIcon />
</IconButton>
<DocumentPopover
open={Boolean(moreButtonanchorEl)}
anchorEl={moreButtonanchorEl}
open={Boolean(moreButtonAnchorEl)}
anchorEl={moreButtonAnchorEl}
onClose={handleDocumentMenuClose}
/>
</Stack>
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/store/workspaceSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ export const selectWorkspace = (state: RootState) => state.workspace;

/**
* Manages workspace-related state.
*
* * This slice handles:
* - `data`: The currently active workspace, including:
* - `id`: Unique identifier for the workspace.
* - `title`: The name of the workspace.
* - `slug`: A URL-friendly identifier for the workspace.
* - `updatedAt`: The timestamp of the last update to the workspace.
* - `createdAt`: The timestamp when the workspace was created.
*/
const reducer = workspaceSlice.reducer;

Expand Down

0 comments on commit 9cb6703

Please sign in to comment.