Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: quick adjustment to "History" tab to display "Coming soon" #3050

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 23 additions & 13 deletions editor.planx.uk/src/pages/FlowEditor/components/PreviewBrowser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@ import List from "@mui/material/List";
import ListItem from "@mui/material/ListItem";
import ListItemText from "@mui/material/ListItemText";
import { styled } from "@mui/material/styles";
import Tab, { tabClasses } from '@mui/material/Tab';
import Tabs from '@mui/material/Tabs';
import Tab, { tabClasses } from "@mui/material/Tab";
import Tabs from "@mui/material/Tabs";
import Tooltip from "@mui/material/Tooltip";
import Typography from "@mui/material/Typography";
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import { AxiosError } from "axios";
import formatDistanceToNow from "date-fns/formatDistanceToNow";
import React, { useState } from "react";
import { useAsync } from "react-use";
import { FeaturePlaceholder } from "ui/editor/FeaturePlaceholder";
import Caret from "ui/icons/Caret";
import Input from "ui/shared/Input";

Expand Down Expand Up @@ -100,7 +101,6 @@ const TabList = styled(Box)(({ theme }) => ({
},
}));


const StyledTab = styled(Tab)(({ theme }) => ({
position: "relative",
zIndex: 1,
Expand All @@ -122,8 +122,6 @@ const StyledTab = styled(Tab)(({ theme }) => ({
},
})) as typeof Tab;



const formatLastPublish = (date: string, user: string) =>
`Last published ${formatDistanceToNow(new Date(date))} ago by ${user}`;

Expand Down Expand Up @@ -160,7 +158,7 @@ interface AlteredNode {
data?: any;
}

type SideBarTabs = "PreviewBrowser" | "History"
type SideBarTabs = "PreviewBrowser" | "History";

const AlteredNodeListItem = (props: { node: AlteredNode }) => {
const { node } = props;
Expand Down Expand Up @@ -630,22 +628,34 @@ const PreviewBrowser: React.FC<{
</Header>
<TabList>
<Tabs centered onChange={handleChange} value={activeTab} aria-label="">
<StyledTab disableFocusRipple disableTouchRipple disableRipple value="PreviewBrowser" label="Preview" />
<StyledTab disableFocusRipple disableTouchRipple disableRipple value="History" label="History" />
<StyledTab
disableFocusRipple
disableTouchRipple
disableRipple
value="PreviewBrowser"
label="Preview"
/>
<StyledTab
disableFocusRipple
disableTouchRipple
disableRipple
value="History"
label="History"
/>
</Tabs>
</TabList>
{activeTab === "PreviewBrowser" &&
{activeTab === "PreviewBrowser" && (
<SidebarContainer>
<Questions previewEnvironment="editor" key={String(key)} />
</SidebarContainer>
}
{activeTab === "History" &&
)}
{activeTab === "History" && (
<SidebarContainer py={3}>
<Container>
<p>History</p>
<FeaturePlaceholder title="Coming soon" />
</Container>
</SidebarContainer>
}
)}
{showDebugConsole && <DebugConsole />}
</EmbeddedBrowser>
);
Expand Down
Loading