diff --git a/bun.lockb b/bun.lockb index 9b061fb..f1c32c9 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 22c7a7a..2646e71 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "eslint-plugin-react-refresh": "^0.4.16", "globals": "^15.14.0", "postcss": "^8.4.49", + "sass-embedded": "^1.83.1", "tailwindcss": "^3.4.17", "typescript": "~5.6.2", "typescript-eslint": "^8.18.2", diff --git a/src/App.css b/src/App.scss similarity index 100% rename from src/App.css rename to src/App.scss diff --git a/src/App.tsx b/src/App.tsx index 2440422..6e16f8a 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,5 +1,5 @@ import { useEffect, useRef } from 'react'; -import './App.css'; +import './App.scss'; import { TierImage } from './components/Image'; import { Tier, TierProps } from './components/Tier'; import { useAppDispatch, useAppSelector } from './hooks'; @@ -79,6 +79,7 @@ function App() { name='imageUpload' accept='.jpeg' ref={uploadBtn} + multiple style={{ display: 'none' }} onChange={event => { console.log(event.target.files); diff --git a/src/components/Image.scss b/src/components/Image.scss new file mode 100644 index 0000000..7db6083 --- /dev/null +++ b/src/components/Image.scss @@ -0,0 +1,5 @@ +.anime-container:hover { + .anime-name { + opacity: 100; + } +} \ No newline at end of file diff --git a/src/components/Image.tsx b/src/components/Image.tsx index 6958a1c..e9ea963 100644 --- a/src/components/Image.tsx +++ b/src/components/Image.tsx @@ -1,4 +1,5 @@ import { tierImage } from '../store'; +import './Image.scss'; interface ImageProps { image: tierImage; onDragStart?: () => void; @@ -7,16 +8,16 @@ interface ImageProps { export const TierImage = ({ image, onDragStart }: ImageProps) => { return (
{ // e.preventDefault(); if (onDragStart) onDragStart(); }} > -
+
{image.name} -
- {image.name} +
+ {image.name.length > 30 ? image.name.slice(0, 30) + '...' : image.name}
diff --git a/src/components/Tier.tsx b/src/components/Tier.tsx index b96189d..c1fdef3 100644 --- a/src/components/Tier.tsx +++ b/src/components/Tier.tsx @@ -35,6 +35,7 @@ export const Tier = ({ color, name, textColor }: TierProps) => { } const [currentDragImage, setCurrentDragImage] = useState(null); + const [currentDragTier, setCurrentDragTier] = useState(''); const onDragStart = (image: tierImage) => { setCurrentDragImage(image); @@ -43,15 +44,23 @@ export const Tier = ({ color, name, textColor }: TierProps) => { return ( <>
{ // e.preventDefault(); - if (currentDragImage) dispatch(changeTierImage(currentDragImage)); + if (currentDragImage) { + if (currentDragImage.category === name) return; + console.log(currentDragImage); + console.log(name); + dispatch(changeTierImage({ ...currentDragImage, category: name })); + } setCurrentDragImage(null); }} + onDragOver={() => { + if (currentDragTier !== name) setCurrentDragTier(name); + }} >
{ >

{name}

-
+
{tierImages .filter(image => image.category === name) .map((image, index) => ( diff --git a/src/index.css b/src/index.scss similarity index 100% rename from src/index.css rename to src/index.scss diff --git a/src/main.tsx b/src/main.tsx index dbac8e5..aa8806a 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -2,7 +2,7 @@ import { StrictMode } from 'react'; import { createRoot } from 'react-dom/client'; import { Provider } from 'react-redux'; import App from './App.tsx'; -import './index.css'; +import './index.scss'; import store from './store.ts'; createRoot(document.getElementById('root')!).render( diff --git a/vite.config.ts b/vite.config.ts index 2328e17..7a00916 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,7 +1,10 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react-swc' +import react from '@vitejs/plugin-react-swc'; +import { defineConfig } from 'vite'; // https://vite.dev/config/ export default defineConfig({ plugins: [react()], -}) + define: { + 'process.env': {}, + }, +});