Skip to content

Renewed: Improve Styling #337

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

Open
wants to merge 32 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
14d7280
style: global pass to improve stylings.
crhallberg Oct 31, 2024
64fdf67
chore: client:format
crhallberg Nov 4, 2024
dc8ce5e
style: reduce and unify color palette
crhallberg Nov 4, 2024
dd388b5
tests: update snapshots.
crhallberg Nov 4, 2024
ce62e3f
test: make button text more flexible
crhallberg Nov 20, 2024
f08ff29
Merge branch 'dev' into improve-styles
demiankatz Nov 21, 2024
098d1ca
Commit from GitHub Actions (Lint Pull Requests)
github-actions[bot] Nov 21, 2024
8d4cc46
chore: root format.
crhallberg Jan 14, 2025
d2a7c73
Merge branch 'improve-styles' of https://github.com/FalveyLibraryTech…
crhallberg Jan 14, 2025
719bc59
feat: add icon for Deleted state. i think this is the right state.
crhallberg Jan 14, 2025
9c2f300
Commit from GitHub Actions (Lint Pull Requests)
github-actions[bot] Jan 14, 2025
73e52f5
chore: update snapshots.
crhallberg Jan 14, 2025
62e944b
Merge branch 'improve-styles' of https://github.com/FalveyLibraryTech…
crhallberg Jan 14, 2025
814c314
Merge branch 'dev' into improve-styles
demiankatz Jan 15, 2025
9612b1b
style: harmony colors.
crhallberg Apr 1, 2025
bb026a1
style: padding and color adjustments.
crhallberg Apr 1, 2025
c7d3028
style: item edit colors and layout.
crhallberg Apr 1, 2025
7ef316d
style: job paginator.
crhallberg Apr 1, 2025
a7479c2
Commit from GitHub Actions (Lint Pull Requests)
github-actions[bot] Apr 1, 2025
929a488
Merge branch 'dev' into improve-styles
demiankatz Apr 3, 2025
a71c63b
css: status btn improvements.
crhallberg Apr 3, 2025
337d251
populated datastreams to green. fix status buttons in ObjectSummary.
crhallberg Apr 3, 2025
c40fe24
lint
crhallberg Apr 3, 2025
f11d797
ci: mixed whitespace.
crhallberg Apr 14, 2025
27a7801
fix: object button bar delete.
crhallberg Apr 24, 2025
c503f42
Convert tabs to spaces.
demiankatz Apr 25, 2025
9b3072c
Merge branch 'dev' into improve-styles
demiankatz Apr 25, 2025
5feb626
Update snapshots.
demiankatz Apr 25, 2025
5c60e08
revert: DatastreamControlButton and unused object-editor.css.
crhallberg May 5, 2025
296caf6
testing: fix snapshot.
crhallberg May 5, 2025
43c573c
license or remove vendor files.
crhallberg May 27, 2025
a9fed82
fix: icon sizes and contrast.
crhallberg May 27, 2025
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
2 changes: 1 addition & 1 deletion client/components/LogoutButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const LogoutButton = (): React.ReactElement => {
}, [token]);
return showButton ? (
<div className="logout">
<a href={logoutUrl} className="button" onClick={clearToken}>
<a href={logoutUrl} className="button btn-primary" onClick={clearToken}>
Log Out
</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion client/components/__snapshots__/LogoutButton.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exports[`LogoutButton renders correctly when logged in 1`] = `
className="logout"
>
<a
className="button"
className="button btn-primary"
href="http://localhost:9000/api/auth/logout"
onClick={[MockFunction]}
>
Expand Down
3 changes: 1 addition & 2 deletions client/components/edit/Breadcrumbs.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import styles from "../shared/Breadcrumbs.module.css";
import React, { useEffect, useState } from "react";
import BasicBreadcrumbs from "../shared/BasicBreadcrumbs";
import { TreeNode, processBreadcrumbData } from "../../util/Breadcrumbs";
Expand Down Expand Up @@ -71,7 +70,7 @@ const Breadcrumbs = ({ pid = null, initiallyShallow = true }: BreadcrumbsProps):
</li>,
);
return (
<ul className={styles.breadcrumb} key={"breadcrumbs_" + keySuffix}>
<ul className="breadcrumbs" key={"breadcrumbs_" + keySuffix}>
{breadcrumbs}
</ul>
);
Expand Down
2 changes: 1 addition & 1 deletion client/components/edit/CopyPidButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface CopyPidButtonProps {
const CopyPidButton = ({ pid }: CopyPidButtonProps): React.ReactElement => {
return (
<button onClick={() => navigator.clipboard.writeText(pid)}>
<ContentCopy style={{ height: "14px" }} titleAccess={`Copy PID (${pid}) to clipboard`} />
<ContentCopy titleAccess={`Copy PID (${pid}) to clipboard`} />
</button>
);
};
Expand Down
7 changes: 7 additions & 0 deletions client/components/edit/DeleteObjectButton.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.deleteBtn {
&:hover,
&:focus {
background-color: var(--red-700);
border-color: var(--red-700);
}
}
3 changes: 2 additions & 1 deletion client/components/edit/DeleteObjectButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useEffect, useState } from "react";
import styles from "./DeleteObjectButton.module.css";
import { useEditorContext } from "../../context/EditorContext";
import Delete from "@mui/icons-material/Delete";
import { getObjectParentsUrl, getObjectRecursiveChildPidsUrl } from "../../util/routes";
Expand Down Expand Up @@ -90,7 +91,7 @@ const DeleteObjectButton = ({ pid }: DeleteObjectButtonProps): React.ReactElemen
};
const visible = statusMessage.length === 0 && trashPid && loaded && childPidResponse?.loading !== true;
return visible ? (
<button onClick={performDelete}>
<button className={`object-delete-btn ${styles.deleteBtn}`} onClick={performDelete}>
<Delete style={{ height: "14px" }} titleAccess="Delete Object and Children" />
</button>
) : (
Expand Down
22 changes: 22 additions & 0 deletions client/components/edit/ObjectButtonBar.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.objectBar {
display: grid;
grid-template-columns: repeat(5, auto);
width: fit-content;

& button {
width: fit-content;
white-space: nowrap;
border-inline-width: 0;
border-radius: 0;

&:first-child {
border-inline-start-width: 1px;
border-radius: 4px 0 0 4px;
}

&:last-child {
border-inline-end-width: 1px;
border-radius: 0 4px 4px 0;
}
}
}
2 changes: 1 addition & 1 deletion client/components/edit/ObjectButtonBar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe("ObjectButtonBar", () => {
it("can refresh a list of children", async () => {
render(<ObjectButtonBar pid={pid} />);
const refreshIcon = screen.getByRole("button");
expect(refreshIcon.textContent).toEqual("Refresh children");
expect(refreshIcon.textContent.trim()).toEqual("Refresh");
await userEvent.setup().click(refreshIcon);
await waitFor(() => expect(mockContext.action.clearPidFromChildListStorage).toHaveBeenCalledTimes(1));
expect(mockContext.action.clearPidFromChildListStorage).toHaveBeenCalledWith(pid);
Expand Down
19 changes: 14 additions & 5 deletions client/components/edit/ObjectButtonBar.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import React from "react";
import styles from "./ObjectButtonBar.module.css";

import { useEditorContext } from "../../context/EditorContext";
import ObjectPreviewButton from "./ObjectPreviewButton";
import ObjectStatus from "./ObjectStatus";
import Refresh from "@mui/icons-material/Refresh";
import EditParentsButton from "./EditParentsButton";
import DeleteObjectButton from "./DeleteObjectButton";

import RefreshIcon from "@mui/icons-material/Refresh";

export interface ObjectButtonBarProps {
pid: string;
}
Expand All @@ -16,15 +19,21 @@ const ObjectButtonBar = ({ pid }: ObjectButtonBarProps): React.ReactElement => {
} = useEditorContext();

return (
<>
<div className={styles.objectBar}>
<ObjectStatus pid={pid} />
<EditParentsButton pid={pid} />
<button onClick={() => clearPidFromChildListStorage(pid)}>
<Refresh style={{ height: "14px" }} titleAccess="Refresh children" />
<button
type="button"
className={styles.refreshBtn}
onClick={() => clearPidFromChildListStorage(pid)}
title="Refresh children"
>
<RefreshIcon />
Refresh
</button>
<ObjectPreviewButton pid={pid} />
<DeleteObjectButton pid={pid} />
</>
</div>
);
};

Expand Down
4 changes: 2 additions & 2 deletions client/components/edit/ObjectEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const ObjectEditor = ({ pid }: ObjectEditorProps): React.ReactElement => {
<h1>Editor: Object {pid}</h1>
<ObjectSummary />
<Grid container>
<Grid item xs={4}>
<Grid item md>
<Box>
<h3>Object Tools</h3>
<ul>
Expand All @@ -43,7 +43,7 @@ const ObjectEditor = ({ pid }: ObjectEditorProps): React.ReactElement => {
</ul>
</Box>
</Grid>
<Grid item xs={4}>
<Grid item md>
<Box>
<h3>Datastreams</h3>
<DatastreamList />
Expand Down
2 changes: 1 addition & 1 deletion client/components/edit/ObjectOrder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const ObjectOrder = ({ pid }: ObjectOrderProps): React.ReactElement => {
<div>{statusMessage}</div>
) : (
<div>
Current sort: {currentSort}
Current sort: {currentSort}&nbsp;
<button
onClick={() => {
changeSort(otherSort);
Expand Down
48 changes: 38 additions & 10 deletions client/components/edit/ObjectStatus.module.css
Original file line number Diff line number Diff line change
@@ -1,19 +1,47 @@
.active .indicator {
color: green;
.status_btn {
min-width: 120px;

&:is(:hover, &:focus) {
color: white;
}
}

.inactive .indicator {
color: yellow;
.status_btn.active {
background-color: var(--object-status-active);

&:hover, &:focus {
color: white;
background-color: var(--object-status-active-text);
border-color: var(--object-status-active-text);
}
}

.deleted .indicator {
color: red;
.status_btn.inactive {
background-color: var(--object-status-inactive);

&:hover, &:focus {
color: white;
background-color: var(--object-status-inactive-text);
border-color: var(--object-status-inactive-text);
}
}

.unknown .indicator {
color: gray;
.status_btn.deleted {
background-color: var(--object-status-deleted);

&:hover, &:focus {
color: white;
background-color: var(--object-status-deleted-text);
border-color: var(--object-status-deleted-text);
}
}

.indicator {
text-shadow: -1px 1px 0 #000, 1px 1px 0 #000, 1px -1px 0 #000, -1px -1px 0 #000;
.status_btn.unknown {
background-color: var(--object-status-unknown);

&:hover, &:focus {
color: white;
background-color: var(--object-status-unknown-text);
border-color: var(--object-status-unknown-text);
}
}
28 changes: 23 additions & 5 deletions client/components/edit/ObjectStatus.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
import styles from "./ObjectStatus.module.css";
import React from "react";
import styles from "./ObjectStatus.module.css";

import { useGlobalContext } from "../../context/GlobalContext";
import { useEditorContext } from "../../context/EditorContext";
import ObjectLoader from "./ObjectLoader";

import CheckCircleIcon from "@mui/icons-material/CheckCircle";
import CloseIcon from "@mui/icons-material/Close";
import HelpOutlineIcon from "@mui/icons-material/HelpOutline";
import ModeStandbyIcon from "@mui/icons-material/ModeStandby";

export interface ObjectStatusProps {
pid: string;
}

function getStatusIcon(statusText: string) {
switch (statusText) {
case "Active":
return <CheckCircleIcon />;
case "Deleted":
return <CloseIcon />;
case "Inactive":
return <ModeStandbyIcon />;
}
return <HelpOutlineIcon />;
}

export const ObjectStatus = ({ pid }: ObjectStatusProps): React.ReactElement => {
const {
action: { openModal },
Expand All @@ -19,15 +37,15 @@ export const ObjectStatus = ({ pid }: ObjectStatusProps): React.ReactElement =>
const loaded = Object.prototype.hasOwnProperty.call(objectDetailsStorage, pid);
const details = loaded ? objectDetailsStorage[pid] : {};

const stateTxt = details.state ?? "Unknown";
const stateText = details.state ?? "Unknown";
const clickAction = () => {
setStateModalActivePid(pid);
openModal("state");
};
const stateMsg = loaded ? (
<button onClick={clickAction} className={styles[stateTxt.toLowerCase()]}>
<span className={styles.indicator}>&#9673;</span>&nbsp;
{stateTxt}
<button onClick={clickAction} className={`${styles.status_btn} ${styles[stateText.toLowerCase()]}`}>
<span className={styles.indicator}>{getStatusIcon(stateText)}</span>&nbsp;
{stateText}
</button>
) : (
""
Expand Down
20 changes: 16 additions & 4 deletions client/components/edit/ObjectSummary.module.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
.infobox {
background-color: lightgray;
border: 1px solid black;
padding: 5px;
padding-inline: 1lh;
padding-block: 1rem;
color: var(--info-text);
background-color: var(--info);
border: 1px solid var(--info-border);
}

.infobox h2 {
margin: 0;
}
}

.infobox button {
min-width: unset;
padding-block: 0.5em 0.4em;

&:not(:hover,:focus) {
background-color: white;
border-color: black;
}
}
13 changes: 10 additions & 3 deletions client/components/edit/ObjectSummary.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import styles from "./ObjectSummary.module.css";
import CopyPidButton from "./CopyPidButton";
import React, { useEffect } from "react";
import HtmlReactParser from "html-react-parser";

import styles from "./ObjectSummary.module.css";
import CopyPidButton from "./CopyPidButton";
import { useEditorContext } from "../../context/EditorContext";
import ObjectButtonBar from "./ObjectButtonBar";
import ObjectModels from "./ObjectModels";
Expand Down Expand Up @@ -38,7 +39,13 @@ const ObjectSummary = (): React.ReactElement => {
</div>
<h2>{title}</h2>
<div>{HtmlReactParser(description)}</div>
{loaded ? <ObjectButtonBar pid={currentPid} /> : ""}
{loaded ? (
<div style={{ marginBlock: "1rem" }}>
<ObjectButtonBar pid={currentPid} />
</div>
) : (
""
)}
{loaded ? <ObjectOrder pid={currentPid} /> : ""}
{loaded ? <ObjectChildCounts pid={currentPid} /> : ""}
PID: {currentPid} <CopyPidButton pid={currentPid} />
Expand Down
Loading