Skip to content
This repository was archived by the owner on Aug 17, 2025. It is now read-only.

Commit b3e9eff

Browse files
committed
- Added new tests
- Removed react-tabs and replaced it with Headless-UI - Added Tailwind (css files are stil preffered) - Added classnames utility - Added PluginDebugPanel - Improved Settings Modal and UploadModal - Simplified ImportEvent and removed getState() and dispatch() functions - Improved API of rendererRegistry and importerRegistry
1 parent 17cf9bf commit b3e9eff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1302
-501
lines changed

packages/app/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,24 @@
1212
"test:watch": "vitest --watch"
1313
},
1414
"dependencies": {
15-
"@boardify/sdk": "workspace:*",
1615
"@boardify/core-plugins": "workspace:*",
16+
"@boardify/sdk": "workspace:*",
1717
"@codemirror/lang-markdown": "^6.3.2",
1818
"@dnd-kit/core": "^6.3.1",
1919
"@dnd-kit/modifiers": "^9.0.0",
2020
"@dnd-kit/sortable": "^10.0.0",
2121
"@dnd-kit/utilities": "^3.2.2",
2222
"@emotion/css": "^11.13.5",
23+
"@headlessui/react": "^2.2.4",
2324
"@reduxjs/toolkit": "^2.4.0",
25+
"@tailwindcss/vite": "^4.1.10",
2426
"@tauri-apps/api": "^2",
2527
"@tauri-apps/plugin-fs": "^2.2.1",
2628
"@tauri-apps/plugin-log": "^2.3.1",
2729
"@tauri-apps/plugin-shell": "^2",
2830
"@uiw/react-codemirror": "^4.23.10",
2931
"boardify": "file:",
32+
"classnames": "^2.5.1",
3033
"file-type": "^20.4.1",
3134
"framer-motion": "^11.13.1",
3235
"fs-extra": "^11.3.0",
@@ -42,6 +45,7 @@
4245
"react-toastify": "^11.0.5",
4346
"remark-gfm": "^4.0.1",
4447
"reselect": "^5.1.1",
48+
"tailwindcss": "^4.1.10",
4549
"tinycolor2": "^1.6.0",
4650
"uuid": "^11.0.3"
4751
},

packages/app/src/App.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
@import "./assets/styles/index.css";
1+
@import "./assets/styles/index.css";
2+
@import "tailwindcss";

packages/app/src/AppLayout.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import { ToastContainer } from "react-toastify";
22
import { NotificationOverlay } from "./features/notifications";
33
import {
44
isSettingsModalOpen,
5-
SettingsModal,
5+
SettingsModalContent,
66
toggleSettingsModal,
77
} from "./features/settings";
88
import CSSSnippets from "./features/snippets/Snippets";
99
import { Titlebar, ToolbarProvider } from "./features/titlebar";
10-
import { ModalContainer } from "./ui/modal";
10+
import { Modal } from "./ui/modal";
1111
import { ThemeProvider } from "./features/theme";
1212
import { PluginProvider } from "./services/plugins";
1313
import { useAppDispatch, useAppSelector } from "./redux";
@@ -27,12 +27,14 @@ export const AppLayout = ({ children }: AppLayoutProps) => {
2727
<CSSSnippets />
2828
<Titlebar />
2929
<NotificationOverlay />
30-
<ModalContainer
31-
className="modal-dim settings-modal__container"
32-
show={settingsOpen}
30+
<Modal
31+
isOpen={settingsOpen}
32+
onClose={() => dispatch(toggleSettingsModal())}
33+
title="Settings"
34+
className="settings__modal"
3335
>
34-
<SettingsModal onClose={() => dispatch(toggleSettingsModal())} />
35-
</ModalContainer>
36+
<SettingsModalContent />
37+
</Modal>
3638
<ToastContainer />
3739
<div className="app-container">{children}</div>
3840
</ToolbarProvider>

packages/app/src/assets/styles/buttons.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ button {
33
color: var(--text-color, #f6f6f6);
44
border: 1px solid rgba(255, 255, 255, 0.2);
55
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
6-
padding: 5px 10px;
6+
padding: 6px;
77
border-radius: 5px;
88
font-size: var(--font-size);
99
cursor: pointer;
1010
transition: box-shadow 0.2s ease;
11+
display: inline-grid;
12+
place-items: center;
1113
}
1214

1315
button:disabled {

packages/app/src/features/board/components/nodes/NodesRenderer.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ import { useAppSelector } from "@/redux";
22
import { rendererRegistry } from "@/services/renderer";
33
import { ErrorBoundary } from "react-error-boundary";
44
import { FallbackNode } from "./FallbackNode";
5-
import { NodeData, selectVisibleNodes } from "../..";
5+
import { selectVisibleNodes } from "../..";
66

77
export function NodesRenderer() {
8-
const nodes = useAppSelector(selectVisibleNodes);
8+
const visibleNodes = useAppSelector(selectVisibleNodes);
99

1010
return (
1111
<>
12-
{nodes.map((node: NodeData<unknown>) => {
13-
const Renderer = rendererRegistry.get(node.type);
12+
{visibleNodes.map((node) => {
13+
const Renderer = rendererRegistry.getRendererForNode(node);
14+
1415
return (
1516
<ErrorBoundary
1617
key={node.id}

packages/app/src/features/board/store/nodes/nodesSelectors.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,13 @@ export const selectVisibleNodes = createSelector(
4242
.filter((n) => n.layerId === selLayer)
4343
.sort((a, b) => a.zIndex - b.zIndex)
4444
);
45+
46+
export const selectVisibleNodesIds = createSelector(
47+
selectAllNodes,
48+
selectSelectedLayerId,
49+
(nodes, selLayer) =>
50+
nodes
51+
.filter((n) => n.layerId === selLayer)
52+
.sort((a, b) => a.zIndex - b.zIndex)
53+
.map((ctx) => ctx.id)
54+
);

packages/app/src/features/settings/components/SettingsModal.stories.tsx

Lines changed: 0 additions & 6 deletions
This file was deleted.

packages/app/src/features/settings/components/SettingsModal.tsx

Lines changed: 0 additions & 81 deletions
This file was deleted.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import { Tab, TabGroup, TabList, TabPanel, TabPanels } from "@headlessui/react";
2+
import "react-tabs/style/react-tabs.css";
3+
import "./settingsModal.styles.css";
4+
import { SnippetControls } from "./snippets/SnippetControls";
5+
import { Toggle } from "@/ui/toggle/Toggle";
6+
import { useState } from "react";
7+
import { PluginDebugPanel } from "@/services/plugins";
8+
import classNames from "classnames";
9+
10+
const tabLabels = ["General", "Appearance", "Shortcuts", "About"];
11+
export const SettingsModalContent = () => {
12+
const [booleanValue, setBooleanValue] = useState(false);
13+
14+
return (
15+
<TabGroup>
16+
<div className="settings__tabs">
17+
<TabList className="settings__tab-list">
18+
{tabLabels.map((label) => (
19+
<Tab
20+
key={label}
21+
className={({ selected }) =>
22+
classNames("settings__tab", selected && "settings__tab--active")
23+
}
24+
>
25+
{label}
26+
</Tab>
27+
))}
28+
</TabList>
29+
30+
<TabPanels>
31+
<TabPanel className="settings__panel">
32+
<Toggle value={booleanValue} onChange={(e) => setBooleanValue(e)} />
33+
<input type="text" id="language" />
34+
<input type="range" />
35+
<input type="checkbox" id="auto-launch" />
36+
<input type="radio" name="theme" />
37+
38+
<button>Test</button>
39+
<button className="accent">Test</button>
40+
<p className="settings__panel-text">
41+
Options like language, auto-launch, etc.
42+
</p>
43+
</TabPanel>
44+
45+
<TabPanel className="settings__panel">
46+
<SnippetControls />
47+
</TabPanel>
48+
49+
<TabPanel className="settings__panel">
50+
<p className="settings__panel-text">
51+
Customize keyboard shortcuts here.
52+
</p>
53+
</TabPanel>
54+
55+
<TabPanel className="settings__panel">
56+
<p className="settings__panel-text">
57+
App version, author info, and licensing.
58+
</p>
59+
<PluginDebugPanel />
60+
</TabPanel>
61+
</TabPanels>
62+
</div>
63+
</TabGroup>
64+
);
65+
};

packages/app/src/features/settings/components/settingsModal.styles.css

Lines changed: 29 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,77 +2,70 @@
22
width: 600px;
33
height: 80vh;
44
padding: 24px;
5+
background-color: #1e1e1e;
6+
border-radius: 12px;
7+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
8+
overflow-y: auto;
9+
color: #e0e0e0;
510
}
611

712
.settings__title {
813
font-size: 22px;
914
margin-bottom: 20px;
10-
font-weight: bold;
15+
font-weight: 600;
1116
text-align: center;
17+
color: #ffffff;
1218
}
1319

1420
.settings__tab-list {
1521
display: flex;
16-
padding: 0;
17-
border-bottom: 1px solid #444;
22+
gap: 4px;
1823
margin-bottom: 16px;
24+
padding: 4px;
25+
background-color: #2a2a2a;
26+
border-radius: 8px;
1927
}
2028

2129
.settings__tab {
22-
display: flex;
23-
flex-grow: 1;
30+
flex: 1;
2431
text-align: center;
25-
flex-direction: column;
26-
height: 100%;
27-
padding: 8px 12px;
32+
padding: 10px 0;
2833
border: none;
29-
background: none;
30-
color: #ccc;
34+
background: transparent;
35+
color: #aaa;
3136
cursor: pointer;
3237
font-size: 14px;
33-
border-radius: 4px 4px 0 0;
34-
transition: background-color 0.2s ease;
35-
list-style-type: none;
36-
user-select: none;
38+
font-weight: 500;
39+
border-radius: 6px;
40+
transition: background 0.2s ease, color 0.2s ease;
3741
}
3842

39-
.settings__tab:not(.settings__tab--active):hover {
40-
background-color: #2c2c2c;
43+
.settings__tab:hover {
44+
background-color: #333;
4145
}
4246

4347
.settings__tab--active {
44-
background-color: var(--accent-color, #3c3c3c);
48+
background-color: var(--accent-color, #3f51b5);
4549
color: #fff;
46-
font-weight: bold;
50+
font-weight: 600;
4751
}
4852

4953
.settings__panel {
50-
display: none;
51-
}
52-
53-
.react-tabs__tab-panel--selected.settings__panel {
54-
display: block;
55-
padding: 12px 0;
54+
padding-top: 12px;
55+
display: flex;
56+
flex-direction: column;
57+
gap: 12px;
5658
}
5759

5860
.settings__panel-title {
5961
font-size: 18px;
6062
margin-bottom: 8px;
63+
font-weight: 600;
64+
color: #fff;
6165
}
6266

6367
.settings__panel-text {
6468
font-size: 14px;
6569
color: #ccc;
66-
}
67-
68-
.modal__close-button {
69-
position: absolute;
70-
top: 16px;
71-
right: 16px;
72-
background: none;
73-
border: none;
74-
color: #ccc;
75-
font-size: 24px;
76-
cursor: pointer;
77-
transition: color 0.2s ease;
70+
line-height: 1.5;
7871
}

0 commit comments

Comments
 (0)