Skip to content

Commit

Permalink
Redesign space settings
Browse files Browse the repository at this point in the history
  • Loading branch information
cptrodgers committed May 13, 2024
1 parent c69c539 commit 30a3c68
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 39 deletions.
75 changes: 55 additions & 20 deletions apps/ikigai/components/DocumentV2/LeftSide/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import React, { useState } from "react";
import { Divider, Tooltip, Typography } from "antd";
import { Button, Divider, Tooltip, Typography } from "antd";
import { t, Trans } from "@lingui/macro";
import styled, { useTheme } from "styled-components";
import { PlusOutlined, SettingOutlined, SwapOutlined } from "@ant-design/icons";
import Icon, {
PlusOutlined,
SettingOutlined,
SwapOutlined,
} from "@ant-design/icons";

import useAuthUserStore from "context/ZustandAuthStore";
import EditProfileModal from "components/UserCredential/EditProfileModal";
Expand All @@ -18,6 +22,9 @@ import usePermission from "hook/UsePermission";
import useSpaceStore from "context/ZustandSpaceStore";
import CreateContentButton from "components/common/LearningModuleDnd/CreateContentButton";
import SwitchSpace from "components/SwitchSpace";
import Image from "next/image";
import ButtonGroup from "antd/es/button/button-group";
import { SettingIcon } from "../../common/IconSvg";

const LeftSide = () => {
const allow = usePermission();
Expand All @@ -44,29 +51,34 @@ const LeftSide = () => {
>
{spaceName}
</Typography.Paragraph>
<div style={{ display: "flex", justifyContent: "flex-end" }}>
<Tooltip arrow={false} title={t`Switch spaces`}>
<TextButtonWithHover
type="text"
icon={
<SwapOutlined style={{ color: theme.colors.gray[7] }} />
}
onClick={() => setOpenSwitchSpace(true)}
/>
</Tooltip>
<NoMarginDivider $margin={5} />
<div
style={{
display: "flex",
flexDirection: "column",
paddingRight: 20,
}}
>
{allow(SpaceActionPermission.MANAGE_SPACE_SETTING) && (
<Tooltip arrow={false} title={t`Space settings`}>
<TextButtonWithHover
type="text"
icon={
<SettingOutlined
style={{ color: theme.colors.gray[7] }}
/>
}
<LessonItemContainer
onClick={() => setSpaceSettingVisible(true)}
/>
>
<SettingIcon style={{ color: theme.colors.gray[7] }} />
<Typography.Text type="secondary" strong>
<Trans>Space Settings</Trans>
</Typography.Text>
</LessonItemContainer>
</Tooltip>
)}
<Tooltip arrow={false} title={t`Switch spaces`}>
<LessonItemContainer onClick={() => setOpenSwitchSpace(true)}>
<SwapOutlined style={{ color: theme.colors.gray[7] }} />
<Typography.Text type="secondary" strong>
<Trans>Switch Space</Trans>
</Typography.Text>
</LessonItemContainer>
</Tooltip>
</div>
</SpaceInformation>
</SpaceInfoContainer>
Expand Down Expand Up @@ -170,3 +182,26 @@ const StyledButton = styled(TextButtonWithHover)`
margin: unset;
color: #888e9c;
`;

const LessonItemContainer = styled.div<{
$active?: boolean;
}>`
width: 100%;
display: flex;
align-items: center;
padding: 0 5px 0 10px;
height: 38px;
gap: 8px;
cursor: pointer;
background-color: ${(props) => {
if (props.$active) {
return props.theme.colors.gray[2];
}
return "unset";
}};
border-radius: 8px;
&:hover {
background-color: ${(props) => props.theme.colors.gray[2]};
}
`;
6 changes: 2 additions & 4 deletions apps/ikigai/components/SwitchSpace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ const SwitchSpace = ({ visible, onClose }: SwitchSpaceProps) => {
width="400px"
>
<div>
<Typography.Text type="secondary">
<Trans>Click a space to switch</Trans>
</Typography.Text>
<Divider />
{spaces.map((space) => (
<SpaceItemContainer
key={space.id}
Expand All @@ -79,7 +77,7 @@ const SwitchSpace = ({ visible, onClose }: SwitchSpaceProps) => {
disabled={loading}
style={{ width: "100%" }}
>
<Trans>Create space</Trans>
<Trans>Create new space</Trans>
</Button>
</div>
</Modal>
Expand Down
16 changes: 1 addition & 15 deletions apps/ikigai/components/common/LearningModuleDnd/LessonItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ const ButtonGroup = styled.div`

const LessonItemContainer = styled.div<{
$active?: boolean;
$editing?: boolean;
}>`
width: 100%;
display: flex;
Expand All @@ -144,28 +143,15 @@ const LessonItemContainer = styled.div<{
gap: 8px;
cursor: pointer;
background-color: ${(props) => {
if (props.$editing) {
return props.theme.colors.gray[0];
}
if (props.$active) {
return props.theme.colors.gray[2];
}
return "unset";
}};
box-shadow: ${(props) => {
if (props.$editing) {
return `
0px 9px 28px 8px rgba(0, 0, 0, 0.05),
0px 3px 6px -4px rgba(0, 0, 0, 0.12),
0px 6px 16px 0px rgba(0, 0, 0, 0.08)
`;
}
}};
border-radius: 8px;
&:hover {
background-color: ${(props) =>
props.theme.colors.gray[props.$editing ? 0 : 2]};
background-color: ${(props) => props.theme.colors.gray[2]};
${ButtonGroup} {
display: flex;
}
Expand Down

0 comments on commit 30a3c68

Please sign in to comment.