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

Commit 2509235

Browse files
committed
feat(snippets): Refactor CSS snippets handling and add selectors
- Updated CSSSnippets component to use selectEnabledSnippets selector for better state management. - Combined CSS snippets into a single string for rendering. - Removed unused selectors file and added snippetSelectors for better organization. - Enhanced snippetSlice to include an enabled property for snippets. - Added SnippetCard and SnippetControls components for managing CSS snippets in settings. - Implemented styles for snippet controls and cards. - Introduced selectors for settings modal state management. - Added plugin management system with PluginManager and related types for better extensibility. - Implemented image and video plugins with importers and node renderers. - Added support for GIF and image nodes with appropriate rendering and importing logic. - Created note node with markdown support and text importing functionality.
1 parent a37711b commit 2509235

Some content is hidden

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

64 files changed

+697
-222
lines changed

src-tauri/src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
pub fn run() {
33
tauri::Builder::default()
44
.plugin(tauri_plugin_fs::init())
5-
.plugin(tauri_plugin_log::Builder::new().build())
5+
.plugin(
6+
tauri_plugin_log::Builder::new()
7+
.target(tauri_plugin_log::Target::new(
8+
tauri_plugin_log::TargetKind::Webview,
9+
))
10+
.build(),
11+
)
612
.plugin(tauri_plugin_shell::init())
713
.run(tauri::generate_context!())
814
.expect("error while running tauri application");

src/App.tsx

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import AppTheme from "@/features/theme/AppTheme"
21
import { store } from "@store"
32
import { Provider } from "react-redux"
43
import "./App.css"
@@ -19,21 +18,19 @@ function App() {
1918
return (
2019
<Provider store={store}>
2120
<ContextMenuProvider>
22-
<AppTheme>
23-
<AppLayout>
24-
<Router>
25-
<Routes>
26-
{/*TODO: Remove default redirect*/}
27-
<Route path="/" element={<Navigate to="/editor" replace />} />
28-
<Route path="/ " element={<Home />} />
29-
<Route path="/editor" element={<Editor />} />
30-
</Routes>
31-
</Router>
32-
</AppLayout>
33-
</AppTheme>
21+
<AppLayout>
22+
<Router>
23+
<Routes>
24+
{/*TODO: Remove default redirect*/}
25+
<Route path="/" element={<Navigate to="/editor" replace />} />
26+
<Route path="/ " element={<Home />} />
27+
<Route path="/editor" element={<Editor />} />
28+
</Routes>
29+
</Router>
30+
</AppLayout>
3431
</ContextMenuProvider>
3532
</Provider>
3633
)
3734
}
3835

39-
export default App
36+
export default App

src/AppLayout.tsx

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,41 @@
11
import { ToastContainer } from "react-toastify"
22
import AppSetup from "./AppSetup"
33
import { NotificationOverlay } from "./features/notifications"
4-
import { SettingsModal } from "./features/settings"
4+
import { isSettingsModalOpen, SettingsModal, toggleSettingsModal } from "./features/settings"
55
import CSSSnippets from "./features/snippets/CSSSnippets"
66
import { Titlebar, ToolbarProvider } from "./features/titlebar"
77
import { ModalContainer } from "./features/modal"
8+
import { AppTheme } from "./features/theme"
9+
import { PluginManager } from "./features/plugins"
10+
import { useAppDispatch, useAppSelector } from "./store"
811

912
interface AppLayoutProps {
1013
children: React.ReactNode
1114
}
1215

1316
export const AppLayout = (({ children }: AppLayoutProps) => {
17+
18+
const settingsOpen = useAppSelector(isSettingsModalOpen)
19+
const dispatch = useAppDispatch()
20+
1421
return (
15-
<ToolbarProvider>
16-
<AppSetup />
17-
<CSSSnippets />
18-
<Titlebar />
19-
<NotificationOverlay />
20-
<ModalContainer className="modal-dim">
21-
<SettingsModal onClose={() => console.log("Should close")} />
22-
</ModalContainer>
23-
<ToastContainer />
24-
<div className="app-container">
25-
{children}
26-
</div>
27-
</ToolbarProvider>
22+
<PluginManager>
23+
<AppTheme>
24+
<ToolbarProvider>
25+
26+
<AppSetup />
27+
<CSSSnippets />
28+
<Titlebar />
29+
<NotificationOverlay />
30+
<ModalContainer className="modal-dim settings-modal__container" show={settingsOpen}>
31+
<SettingsModal onClose={() => dispatch(toggleSettingsModal())} />
32+
</ModalContainer>
33+
<ToastContainer />
34+
<div className="app-container">
35+
{children}
36+
</div>
37+
</ToolbarProvider>
38+
</AppTheme>
39+
</PluginManager>
2840
)
2941
})

src/Routes/Editor.tsx

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,46 @@
11
import KeybindControl from "@/features/keybinds/components/KeybindControl";
22
import { GraphView } from "@/features/graph/graphview";
33
import DotGrid from "@/features/graph/grid/DotGrid";
4-
import NodeCanvas from "@/features/graph/renderer/NodesRenderer";
4+
import NodeCanvas from "@/features/graph/renderer/components/NodesRenderer";
55
import { AppDropzone } from "@/features/importing/filedrop";
66
import SidebarButton, { Sidebar } from "@/features/sidebar";
77
import { isSidebarOpen } from "@/features/app/selectors";
88
import { useSelector } from "react-redux";
9+
import { useAppDispatch, useAppSelector } from "@/store";
10+
import { addLayer, selectAllLayers, selectLayer, selectSelectedLayerId } from "@/features/graph";
11+
import { v4 as uuidv4 } from "uuid"
912

1013
export default function Editor() {
14+
const dispatch = useAppDispatch()
1115
const sidebarOpen = useSelector(isSidebarOpen)
16+
const layers = useAppSelector(selectAllLayers)
17+
const selectedLayerId = useAppSelector(selectSelectedLayerId)
18+
19+
const handleAddLayer = () => {
20+
const newLayer = {
21+
id: uuidv4(),
22+
name: `Layer ${layers.length + 1}`,
23+
color: "orange",
24+
icon: "bxs:layer",
25+
}
26+
dispatch(addLayer(newLayer))
27+
dispatch(selectLayer(newLayer.id))
28+
}
1229

1330
return (
1431
<div className="editor-container">
1532
<KeybindControl />
1633
<Sidebar isExpanded={sidebarOpen}>
17-
<SidebarButton label="Hello" icon="mdi:close" selected={true} />
18-
<SidebarButton label="Hello" selected={false} />
19-
<SidebarButton label="Hello" selected={false} />
20-
<SidebarButton label="Hello" selected={false} />
34+
{layers.map((layer) => (
35+
<SidebarButton
36+
key={layer.id}
37+
label={layer.name}
38+
icon={layer.icon}
39+
selected={selectedLayerId === layer.id}
40+
onClick={() => dispatch(selectLayer(layer.id))}
41+
/>
42+
))}
43+
<SidebarButton className="add-layer__button" onClick={handleAddLayer} label={"+"} selected={true}/>
2144
</Sidebar>
2245
<div className="expand-box">
2346
<AppDropzone />

src/assets/styles/base.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ body,
3737
--sidebar-bg: #2c2c2c;
3838
--separator-color: #444;
3939
--text-color: #f6f6f6;
40+
--card-color: #333436;
41+
42+
--graph-bg: #222224;
4043

4144
/* Spacing */
4245
--input-padding: 10px;

src/assets/styles/inputs.css

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ input[type="range"] {
5151
border-radius: 3px;
5252
appearance: none;
5353
cursor: pointer;
54+
padding: initial;
5455
}
5556

5657
input[type="range"]::-webkit-slider-thumb {
@@ -61,35 +62,39 @@ input[type="range"]::-webkit-slider-thumb {
6162
background: var(--accent-color);
6263
border-radius: 50%;
6364
border: none;
64-
margin-top: -6px;
6565
box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
6666
}
6767

6868
input[type="range"]::-moz-range-thumb {
6969
width: var(--slider-thumb-size);
7070
height: var(--slider-thumb-size);
71-
background: var(--accent-color);
71+
background: red;
7272
border: none;
7373
border-radius: 50%;
7474
}
7575

7676
/* Text Inputs */
77+
input,
7778
input[type="text"],
7879
input[type="email"],
79-
input[type="password"] {
80-
width: 100%;
80+
input[type="password"],
81+
textarea {
8182
padding: var(--input-padding);
8283
border: 1px solid var(--separator-color);
8384
border-radius: var(--border-radius);
8485
background-color: var(--sidebar-bg);
8586
color: var(--text-color);
8687
font-size: 1rem;
8788
transition: border 0.2s, box-shadow 0.2s;
89+
resize: none;
90+
margin: 0.1rem;
8891
}
8992

93+
input:focus,
9094
input[type="text"]:focus,
9195
input[type="email"]:focus,
92-
input[type="password"]:focus {
96+
input[type="password"]:focus,
97+
textarea:focus {
9398
outline: none;
9499
border-color: var(--accent-color);
95100
box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.3);

src/features/graph/graphview/graph.styles.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
overflow: hidden;
66
width: 100%;
77
height: 100%;
8-
background-color: #222224;
8+
background-color: var(--graph-bg, #222224);
99
}
1010

1111
.graph-view__content {

src/features/graph/nodes/gif/GifNodeRenderer.tsx

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

src/features/graph/nodes/gif/gifNode.types.d.ts

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

src/features/graph/nodes/gif/index.ts

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

0 commit comments

Comments
 (0)