Skip to content
Open
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions src/DialogComp/Notification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ function Notification({ children, mode }) {
return (
<div
className={`${
mode == "Draft"
? "notification-content-draft"
: "notification-content-finalized"
(mode == "Draft" && "notification-content-draft") ||
(mode == "Finalized" && "notification-content-finalized") ||
(mode == "TemplateScreen" && "notification-content-screen")
}`}
>
{children}
Expand Down
12 changes: 12 additions & 0 deletions src/DialogComp/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,18 @@ button[disabled] {
border-radius: 4px;
}

.notification-content-screen {
width: max-content;
position: absolute;
bottom: -2.4rem;
left: 15.3rem;
font-size: 0.8rem;
background-color: #292929;
color: #fff;
padding: 0.5rem 1rem;
border-radius: 4px;
}

@keyframes overlayShow {
from {
opacity: 0;
Expand Down
29 changes: 26 additions & 3 deletions src/MenuBar/TopMenuBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import React, { useState } from "react";
import { useSetSaveOnServer } from "../store/store";
import Button from "../ui/Button";
import Notification from "@/DialogComp/Notification";
import "./Header.css";

import config from "../utils/config";
Expand All @@ -18,6 +19,7 @@ export default function TopMenuBar() {
const uuid = useUuid();
const interData = useIntermediateData();
const projectID = useProjectID();
const [showNotification, setShowNotification] = useState(false);

const apiUrl = config.apiUrl;

Expand All @@ -35,6 +37,10 @@ export default function TopMenuBar() {
setCopied(false);
}, 3000);

setTimeout(() => {
setShowNotification(false);
}, 8000);

return (
<div>
<div className="topMenuBar">
Expand All @@ -50,9 +56,26 @@ export default function TopMenuBar() {
>
<Button label={copied ? "Copied to clipboard!" : "Share"} />
</div>
<div onClick={() => downloadFile(uuid, templateURL)}>
<Button label="Generate Excel Template" />
</div>
{showNotification && (
<Notification mode="TemplateScreen">
Project is not selected. &nbsp;
<button
onClick={() => downloadFile(uuid, templateURL)}
className="genAnyway"
>
Generate anyway
</button>
</Notification>
)}
{projectID ? (
<div onClick={() => downloadFile(uuid, templateURL)}>
<Button label="Generate Excel Template" />
</div>
) : (
<div onClick={() => setShowNotification(true)}>
<Button label="Generate Excel Template" />
</div>
)}
</div>
{uuid && (
<p className="uuid">
Expand Down