Skip to content

Commit

Permalink
Change previous button actions (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
devleejb authored May 2, 2024
1 parent 8572262 commit e18d3c5
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions frontend/src/components/headers/DocumentHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ import { ActorID } from "yorkie-js-sdk";
import { YorkieCodeMirrorPresenceType } from "../../utils/yorkie/yorkieSync";
import ArrowBackIosNewIcon from "@mui/icons-material/ArrowBackIosNew";
import { useNavigate } from "react-router-dom";
import { selectWorkspace } from "../../store/workspaceSlice";

function DocumentHeader() {
const dispatch = useDispatch();
const navigate = useNavigate();
const editorState = useSelector(selectEditor);
const workspaceState = useSelector(selectWorkspace);
const [
presenceList,
{
Expand Down Expand Up @@ -82,19 +84,21 @@ function DocumentHeader() {
};

const handleToPrevious = () => {
navigate(-1);
navigate(`/${workspaceState.data?.slug}`);
};

return (
<AppBar position="static" sx={{ zIndex: 100 }}>
<Toolbar>
<Stack width="100%" direction="row" justifyContent="space-between">
<Stack direction="row" spacing={1} alignItems="center">
<Tooltip title="Back to Previous Page">
<IconButton color="inherit" onClick={handleToPrevious}>
<ArrowBackIosNewIcon />
</IconButton>
</Tooltip>
{!editorState.shareRole && (
<Tooltip title="Back to Previous Page">
<IconButton color="inherit" onClick={handleToPrevious}>
<ArrowBackIosNewIcon />
</IconButton>
</Tooltip>
)}
<Paper>
{editorState.shareRole !== "READ" && (
<ToggleButtonGroup
Expand Down

0 comments on commit e18d3c5

Please sign in to comment.