Add last modified date to all sidebar pages
This commit is contained in:
parent
8c86871723
commit
e43352ba94
@ -69,6 +69,17 @@ const Sidebar: React.FC<Props> = ({
|
|||||||
return <PluginDetail hash={plugin} counts={counts} />;
|
return <PluginDetail hash={plugin} counts={counts} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const renderLastModified = (lastModified: string | null | undefined) => {
|
||||||
|
if (lastModified) {
|
||||||
|
return (
|
||||||
|
<div className={styles["sidebar-modified-date"]}>
|
||||||
|
<strong>Last updated:</strong>{" "}
|
||||||
|
{formatRelative(new Date(lastModified), new Date())}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const renderOpenSidebar = () => {
|
const renderOpenSidebar = () => {
|
||||||
if (selectedCell) {
|
if (selectedCell) {
|
||||||
return (
|
return (
|
||||||
@ -76,15 +87,18 @@ const Sidebar: React.FC<Props> = ({
|
|||||||
className={styles.sidebar}
|
className={styles.sidebar}
|
||||||
style={!open ? { display: "none" } : {}}
|
style={!open ? { display: "none" } : {}}
|
||||||
>
|
>
|
||||||
<div className={styles["sidebar-header"]}>
|
<div className={styles["sidebar-content"]}>
|
||||||
<button className={styles.close} onClick={onClose}>
|
<div className={styles["sidebar-header"]}>
|
||||||
<Image src={close} width={24} height={24} alt="close" />
|
<button className={styles.close} onClick={onClose}>
|
||||||
</button>
|
<Image src={close} width={24} height={24} alt="close" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<h1 className={styles["cell-name-header"]}>
|
||||||
|
Cell {selectedCell.x}, {selectedCell.y}
|
||||||
|
</h1>
|
||||||
|
{renderCellData(selectedCell)}
|
||||||
|
{renderLastModified(lastModified)}
|
||||||
</div>
|
</div>
|
||||||
<h1 className={styles["cell-name-header"]}>
|
|
||||||
Cell {selectedCell.x}, {selectedCell.y}
|
|
||||||
</h1>
|
|
||||||
{renderCellData(selectedCell)}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else if (router.query.mod) {
|
} else if (router.query.mod) {
|
||||||
@ -94,12 +108,15 @@ const Sidebar: React.FC<Props> = ({
|
|||||||
className={styles.sidebar}
|
className={styles.sidebar}
|
||||||
style={!open ? { display: "none" } : {}}
|
style={!open ? { display: "none" } : {}}
|
||||||
>
|
>
|
||||||
<div className={styles["sidebar-header"]}>
|
<div className={styles["sidebar-content"]}>
|
||||||
<button className={styles.close} onClick={onClose}>
|
<div className={styles["sidebar-header"]}>
|
||||||
<Image src={close} width={24} height={24} alt="close" />
|
<button className={styles.close} onClick={onClose}>
|
||||||
</button>
|
<Image src={close} width={24} height={24} alt="close" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{!Number.isNaN(modId) && renderModData(modId)}
|
||||||
|
{renderLastModified(lastModified)}
|
||||||
</div>
|
</div>
|
||||||
{!Number.isNaN(modId) && renderModData(modId)}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else if (router.query.plugin) {
|
} else if (router.query.plugin) {
|
||||||
@ -108,16 +125,19 @@ const Sidebar: React.FC<Props> = ({
|
|||||||
className={styles.sidebar}
|
className={styles.sidebar}
|
||||||
style={!open ? { display: "none" } : {}}
|
style={!open ? { display: "none" } : {}}
|
||||||
>
|
>
|
||||||
<div className={styles["sidebar-header"]}>
|
<div className={styles["sidebar-content"]}>
|
||||||
<button className={styles.close} onClick={onClose}>
|
<div className={styles["sidebar-header"]}>
|
||||||
<Image src={close} width={24} height={24} alt="close" />
|
<button className={styles.close} onClick={onClose}>
|
||||||
</button>
|
<Image src={close} width={24} height={24} alt="close" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{renderPluginData(
|
||||||
|
typeof router.query.plugin === "string"
|
||||||
|
? router.query.plugin
|
||||||
|
: router.query.plugin[0]
|
||||||
|
)}
|
||||||
|
{renderLastModified(lastModified)}
|
||||||
</div>
|
</div>
|
||||||
{renderPluginData(
|
|
||||||
typeof router.query.plugin === "string"
|
|
||||||
? router.query.plugin
|
|
||||||
: router.query.plugin[0]
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -126,7 +146,7 @@ const Sidebar: React.FC<Props> = ({
|
|||||||
className={styles.sidebar}
|
className={styles.sidebar}
|
||||||
style={!open ? { display: "none" } : {}}
|
style={!open ? { display: "none" } : {}}
|
||||||
>
|
>
|
||||||
<div className={styles["default-sidebar"]}>
|
<div className={styles["sidebar-content"]}>
|
||||||
<h2>Modmapper</h2>
|
<h2>Modmapper</h2>
|
||||||
<p className={styles.subheader}>
|
<p className={styles.subheader}>
|
||||||
An interactive map of Skyrim mods.
|
An interactive map of Skyrim mods.
|
||||||
@ -134,12 +154,7 @@ const Sidebar: React.FC<Props> = ({
|
|||||||
<DataDirPicker />
|
<DataDirPicker />
|
||||||
<PluginTxtEditor />
|
<PluginTxtEditor />
|
||||||
<PluginsList />
|
<PluginsList />
|
||||||
{lastModified && (
|
{renderLastModified(lastModified)}
|
||||||
<div className={styles["sidebar-modified-date"]}>
|
|
||||||
<strong>Last updated:</strong>{" "}
|
|
||||||
{formatRelative(new Date(lastModified), new Date())}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@ -157,13 +172,17 @@ const Sidebar: React.FC<Props> = ({
|
|||||||
className={styles.open}
|
className={styles.open}
|
||||||
onClick={() => setOpen(true)}
|
onClick={() => setOpen(true)}
|
||||||
title="Show sidebar"
|
title="Show sidebar"
|
||||||
><Image src={arrow} alt="show" width={16} height={16} /></button>
|
>
|
||||||
|
<Image src={arrow} alt="show" width={16} height={16} />
|
||||||
|
</button>
|
||||||
) : (
|
) : (
|
||||||
<button
|
<button
|
||||||
className={styles.hide}
|
className={styles.hide}
|
||||||
onClick={() => setOpen(false)}
|
onClick={() => setOpen(false)}
|
||||||
title="Hide sidebar"
|
title="Hide sidebar"
|
||||||
><Image src={arrow} alt="hide" width={16} height={16} /></button>
|
>
|
||||||
|
<Image src={arrow} alt="hide" width={16} height={16} />
|
||||||
|
</button>
|
||||||
)}
|
)}
|
||||||
{renderOpenSidebar()}
|
{renderOpenSidebar()}
|
||||||
</>
|
</>
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
padding-top: 24px;
|
padding-top: 24px;
|
||||||
font-size: 0.875rem;
|
font-size: 0.875rem;
|
||||||
border: 1px solid #222222;
|
border: 1px solid #222222;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media only screen and (max-width: 600px) {
|
@media only screen and (max-width: 600px) {
|
||||||
@ -134,7 +135,7 @@
|
|||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
.default-sidebar {
|
.sidebar-content {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@ -142,6 +143,8 @@
|
|||||||
|
|
||||||
.sidebar-modified-date {
|
.sidebar-modified-date {
|
||||||
margin-top: auto;
|
margin-top: auto;
|
||||||
|
padding-top: 12px;
|
||||||
|
padding-bottom: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.subheader {
|
.subheader {
|
||||||
|
Loading…
Reference in New Issue
Block a user