Skip to content

Commit

Permalink
Content app UI fixes (#2447)
Browse files Browse the repository at this point in the history
* fix: remove horiz margin

* fix: fixed tooltip text

* fix: use zesty mui theme for the info bar buttons

* task: only show tooltip when the button is hovered
  • Loading branch information
finnar-bin authored Jan 12, 2024
1 parent ad2c6d8 commit 6803032
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const WidgetDeleteItem = memo(function WidgetDeleteItem(props) {

return (
<>
<Card sx={{ mx: 2, mb: 3, backgroundColor: "transparent" }} elevation={0}>
<Card sx={{ mb: 3, backgroundColor: "transparent" }} elevation={0}>
<CardHeader
sx={{
p: 0,
Expand Down
79 changes: 45 additions & 34 deletions src/apps/content-editor/src/app/views/ItemEdit/Content/Content.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { Editor } from "../../../components/Editor";
import { PreviewMode } from "../../../components/Editor/PreviewMode";
import { Box, Stack, IconButton, Tooltip, useMediaQuery } from "@mui/material";
import {
Box,
Stack,
IconButton,
Tooltip,
useMediaQuery,
ThemeProvider,
} from "@mui/material";
import { theme } from "@zesty-io/material";
import { StartRounded, DesktopMacRounded } from "@mui/icons-material";
import { Actions } from "./Actions";
import { useLocalStorage } from "react-use";
Expand Down Expand Up @@ -74,46 +82,49 @@ export default function Content(props) {
</Box>
{!showDuoMode ? (
<Box display="flex" gap={1}>
<Stack
gap={1.5}
sx={{
...(!showSidebar && {
position: "absolute",
right: "24px",
}),
}}
>
<Tooltip
title={showSidebar ? "Close Info Bar" : "Open Info Bar"}
placement="left"
dark
<ThemeProvider theme={theme}>
<Stack
gap={1.5}
sx={{
...(!showSidebar && {
position: "absolute",
right: "24px",
}),
}}
>
<IconButton
size="small"
onClick={() => setShowSidebar(!showSidebar)}
data-cy="ContentSidebarToggle"
<Tooltip
title={showSidebar ? "Close Info Bar" : "Open Info Bar"}
placement="left"
>
<StartRounded
fontSize="small"
sx={{
transform: showSidebar ? "rotate(0deg)" : "rotate(180deg)",
}}
/>
</IconButton>
</Tooltip>
{!isDisabled && (
<Tooltip title="Open DUO Mode" placement="left" dark>
<IconButton
size="small"
onClick={() => {
setShowDuoMode(true);
}}
onClick={() => setShowSidebar(!showSidebar)}
data-cy="ContentSidebarToggle"
>
<DesktopMacRounded fontSize="small" />
<StartRounded
fontSize="small"
sx={{
transform: showSidebar
? "rotate(0deg)"
: "rotate(180deg)",
}}
/>
</IconButton>
</Tooltip>
)}
</Stack>
{!isDisabled && (
<Tooltip title="Open DUO Mode" placement="left" dark>
<IconButton
size="small"
onClick={() => {
setShowDuoMode(true);
}}
>
<DesktopMacRounded fontSize="small" />
</IconButton>
</Tooltip>
)}
</Stack>
</ThemeProvider>
{showSidebar && (
<Box
maxWidth={320}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,14 @@ export const ItemEditHeaderActions = ({
</div>
) : (
<div>
v{activePublishing?.version} published on <br />
by {formatDate(activePublishing?.publishAt)} <br />
v{activePublishing?.version} published{" "}
{formatDate(activePublishing?.publishAt).includes("Today") ||
formatDate(activePublishing?.publishAt).includes("Yesterday")
? ""
: "on"}
<br />
{formatDate(activePublishing?.publishAt)} <br />
by{" "}
{
users?.find(
(user: any) =>
Expand Down
6 changes: 5 additions & 1 deletion src/shell/components/ResizeableContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export const ResizableContainer = ({
const [isResizing, setIsResizing] = useState(false);
const [initialPos, setInitialPos] = useState(0);
const [initialWidth, setInitialWidth] = useState(0);
const [isHoveringCollapseButton, setIsHoveringCollapseButton] =
useState(false);
const [width, setWidth] = useLocalStorage(
`zesty:resizableContainer:${id}`,
defaultWidth
Expand Down Expand Up @@ -113,7 +115,7 @@ export const ResizableContainer = ({
placement="right-start"
enterDelay={1000}
enterNextDelay={1000}
open={isTooltipOpen}
open={isTooltipOpen && isHoveringCollapseButton}
onOpen={() => setIsTooltipOpen(true)}
onClose={() => setIsTooltipOpen(false)}
>
Expand All @@ -122,7 +124,9 @@ export const ResizableContainer = ({
onClick={() => {
setIsTooltipOpen(false);
setCollapsed(!collapsed);
setIsHoveringCollapseButton(false);
}}
onMouseOver={() => setIsHoveringCollapseButton(true)}
sx={{
borderRadius: "50%",
borderColor: "grey.600",
Expand Down

0 comments on commit 6803032

Please sign in to comment.