Feat: started working on tier level edit
This commit is contained in:
16
src/App.tsx
16
src/App.tsx
@@ -5,14 +5,9 @@ import './App.scss';
|
||||
import { TierImage } from './components/Image';
|
||||
import { Tier } from './components/Tier';
|
||||
import { TierModal } from './components/TierModal';
|
||||
import { tierImage } from './dto/tier';
|
||||
import useStore from './store';
|
||||
|
||||
interface tierImage {
|
||||
name: string;
|
||||
url: string;
|
||||
category: string;
|
||||
}
|
||||
|
||||
const App = () => {
|
||||
const [images, addTierImage, tierLevels, editTierImage] = useStore(
|
||||
useShallow(state => [state.images, state.addTierImage, state.tierLevels, state.editTierImage]),
|
||||
@@ -24,11 +19,6 @@ const App = () => {
|
||||
if (uploadBtn.current) uploadBtn.current.click();
|
||||
};
|
||||
|
||||
const getRandomCategoryName = () => {
|
||||
const categoryNames = tierLevels.flatMap(category => category.name);
|
||||
return categoryNames[Math.floor(Math.random() * categoryNames.length)];
|
||||
};
|
||||
|
||||
const handleAdd = (images: tierImage[]) => {
|
||||
images.forEach(image => {
|
||||
addTierImage(image);
|
||||
@@ -55,7 +45,7 @@ const App = () => {
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
<div className='flex flex-row w-full'>
|
||||
<div className='flex flex-row w-full '>
|
||||
{images
|
||||
.filter(image => image.category === '')
|
||||
.map((image, index) => (
|
||||
@@ -80,7 +70,7 @@ const App = () => {
|
||||
upload_images.push({
|
||||
url: url,
|
||||
name: event.target.files[i].name.replace('.jpeg', ''),
|
||||
category: getRandomCategoryName(),
|
||||
category: '',
|
||||
});
|
||||
}
|
||||
handleAdd(upload_images);
|
||||
|
||||
Reference in New Issue
Block a user