Skip to content

Commit

Permalink
Multi-Color support (#3)
Browse files Browse the repository at this point in the history
Also includes a revamp of the stored data structure, skeleton loading (not fully fledged), removal of the dependency on data-driven-forms to allow for color fields (yay good UX!!!)
  • Loading branch information
WalkQuackBack authored Apr 3, 2024
1 parent 32687f4 commit 8bc0647
Show file tree
Hide file tree
Showing 65 changed files with 891 additions and 465 deletions.
7 changes: 5 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
<title>B2 Fish Customizer</title>
</head>
<body>
<noscript>Enable JavaScript to use this application</noscript>
<div id="root"></div>
<div id="root">
<div id="side_panel_skeleton">
<noscript>Enable JavaScript to use this application</noscript>
</div>
</div>
<script type="module" src="./src/main.tsx"></script>
</body>
</html>
139 changes: 1 addition & 138 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
},
"dependencies": {
"@ant-design/icons": "^5.3.0",
"@data-driven-forms/ant-component-mapper": "^3.22.3",
"@data-driven-forms/react-form-renderer": "^3.22.3",
"@reduxjs/toolkit": "^2.1.0",
"antd": "^5.14.0",
"react": "^18.2.0",
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
56 changes: 39 additions & 17 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,38 @@
width: 60%;
}

.hexColorApplet {
position: fixed;
display: flex;
z-index: 10;
padding: 6px;
margin: 24px;
border-radius: 6px;

left: 0;
bottom: 0;
background-color: var(--light-1);
box-shadow: 0 0 12px 2px rgba(0 0 0 / 0.1);
}

#changeThemeBtn {
position: absolute;
top: 12px;
right: 12px;
}

.formElementContainer {
display: flex;
flex-direction: column;
margin-bottom: 24px;
}

.formElementContainer > label {
position: relative;
display: inline-flex;
align-items: center;
max-width: 100%;
height: 32px;
color: rgba(0, 0, 0, 0.88);
font-size: 14px;
}

.colorContainer > label {
height: 24px;
}

.colorContainer {
background-color: var(--light-1);
padding: 8px;
border-radius: 6px;
}

/* Small devices (portrait tablets and large phones, 768px and down) */
@media only screen and (max-width: 768px) {
#root {
Expand All @@ -57,10 +69,20 @@
}
}

body.dark .hexColorApplet {
body.dark #side_panel {
background-color: var(--dark-1);
}

body.dark .formElementContainer > label {
color: #ffffff;
}

body.dark .colorContainer {
background-color: var(--dark-2);
}

body.dark #side_panel {
background-color: var(--dark-1);
@keyframes fadeIn {
from {
opacity: 0;
}
}
1 change: 0 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ function App() {
theme.darkAlgorithm,
}}
>
<HexColorApplet />
<div id="side_panel">
<CustomizationPanel />
</div>
Expand Down
66 changes: 43 additions & 23 deletions src/app/features/fishData/fishDataSlice.tsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,54 @@
import { createSlice } from "@reduxjs/toolkit";

import customizationData from "../../../customizationData";
export const fishDataSlice = createSlice({
name: "fishData",
initialState: {
bodyColor: "#FF0000",
hatColor: "#fffd16",
hat: "none",
accessoryColor: "#fffd16",
accessory: "none",
eyewearColor: "#fffd16",
eyewear: "none",
mouth: "default",
finColor: "#fffd16",
fin: "none",
effect: "none",
accessory: customizationData.accessory.defaultValue,
accessoryColorPrimary: customizationData.accessoryColorPrimary.defaultValue,
accessoryColorSecondary:
customizationData.accessoryColorSecondary.defaultValue,
accessoryColorTertiary:
customizationData.accessoryColorTertiary.defaultValue,
bodyColor: customizationData.bodyColor.defaultValue,
effect: customizationData.effect.defaultValue,
eyewear: customizationData.eyewear.defaultValue,
eyewearColorPrimary: customizationData.eyewearColorPrimary.defaultValue,
eyewearColorSecondary: customizationData.eyewearColorSecondary.defaultValue,
eyewearColorTertiary: customizationData.eyewearColorTertiary.defaultValue,
fin: customizationData.fin.defaultValue,
finColorPrimary: customizationData.finColorPrimary.defaultValue,
finColorSecondary: customizationData.finColorSecondary.defaultValue,
finColorTertiary: customizationData.finColorTertiary.defaultValue,
hat: customizationData.hat.defaultValue,
hatColorPrimary: customizationData.hatColorPrimary.defaultValue,
hatColorSecondary: customizationData.hatColorSecondary.defaultValue,
hatColorTertiary: customizationData.hatColorTertiary.defaultValue,
mouth: customizationData.mouth.defaultValue,
},
reducers: {
updateData: (state, action) => {
const payload = action.payload;
state.bodyColor = payload.bodyColor;
state.hatColor = payload.hatColor;
state.hat = payload.hat;
state.accessoryColor = payload.accessoryColor;
state.accessory = payload.accessory;
state.eyewearColor = payload.eyewearColor;
state.eyewear = payload.eyewear;
state.mouth = payload.mouth;
state.finColor = payload.finColor;
state.fin = payload.fin;
state.effect = payload.effect;
const identifier:
| "accessory"
| "accessoryColorPrimary"
| "accessoryColorSecondary"
| "accessoryColorTertiary"
| "bodyColor"
| "effect"
| "eyewear"
| "eyewearColorPrimary"
| "eyewearColorSecondary"
| "eyewearColorTertiary"
| "fin"
| "finColorPrimary"
| "finColorSecondary"
| "finColorTertiary"
| "hat"
| "hatColorPrimary"
| "hatColorSecondary"
| "hatColorTertiary"
| "mouth" = payload.identifier;
state[identifier] = payload.value;
},
},
});
Expand Down
Loading

0 comments on commit 8bc0647

Please sign in to comment.