Feat: first-beta

This commit is contained in:
2025-01-14 15:27:46 +03:00
parent bfc9b9a367
commit ff5dc072a0
5 changed files with 76 additions and 48 deletions

View File

@@ -1,7 +1,7 @@
{ {
"name": "nwtierlist", "name": "nwtierlist",
"private": true, "private": true,
"version": "0.0.0", "version": "0.0.1",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@@ -1,4 +1,5 @@
import { DndContext, DragEndEvent } from '@dnd-kit/core'; import { DndContext, DragEndEvent } from '@dnd-kit/core';
import { GitHub } from '@mui/icons-material';
import { useRef } from 'react'; import { useRef } from 'react';
import { useShallow } from 'zustand/shallow'; import { useShallow } from 'zustand/shallow';
import './App.scss'; import './App.scss';
@@ -35,54 +36,72 @@ const App = () => {
}; };
return ( return (
<DndContext onDragEnd={handleDragEnd}> <div className='bg-[#2d3436] w-full h-full pb-5'>
<div className='flex flex-col w-full'> <div className='bg-[#2d3436] w-full h-12 flex flex-row justify-center items-center text-[#dfe6e9] text-2xl border-b-2'>
{tierLevels.map(tier_level => ( NwTierList
<Tier
color={tier_level.color}
textColor={tier_level.textColor}
name={tier_level.name}
id={tier_level.id}
key={tier_level.id ?? tier_level.name}
/>
))}
</div> </div>
<div className='flex flex-row w-full gap-1 p-5 flex-wrap'> <DndContext onDragEnd={handleDragEnd}>
{images <div className='flex flex-col w-full'>
.filter(image => image.category === '') {tierLevels.map(tier_level => (
.map((image, index) => ( <Tier
<TierImage image={image} key={index} /> color={tier_level.color}
textColor={tier_level.textColor}
name={tier_level.name}
id={tier_level.id}
key={tier_level.id ?? tier_level.name}
/>
))} ))}
</div> </div>
<div className='border border-black w-20 text-center cursor-pointer' onClick={clickUpload}> {images.some(image => image.category === '') && (
<span>Upload</span> <div className='flex flex-row w-full gap-1 p-5 flex-wrap'>
<input {images
type='file' .filter(image => image.category === '')
name='imageUpload' .map((image, index) => (
accept='.jpeg' <TierImage image={image} key={index} />
ref={uploadBtn} ))}
multiple </div>
style={{ display: 'none' }} )}
onChange={event => { <div
console.log(event.target.files); className='border border-[#dfe6e9] w-32 text-center cursor-pointer text-[#dfe6e9] hover:text-[#2d3436] hover:bg-[#dfe6e9]
if (event.target.files) { hover:rounded-xl hover:scale-110 active:text-[#2d3436] active:bg-[#dfe6e9] active:rounded-xl active:scale-110 rounded-lg mt-5 ms-auto me-auto
const upload_images: tierImage[] = []; transition-all duration-300 ease-in-out'
for (let i = 0; i < event.target.files.length; i++) { onClick={clickUpload}
const url = URL.createObjectURL(event.target.files[i]); >
upload_images.push({ <span>Add photo</span>
url: url, <input
name: event.target.files[i].name.replace('.jpeg', ''), type='file'
category: '', name='imageUpload'
}); accept='.jpeg'
ref={uploadBtn}
multiple
style={{ display: 'none' }}
onChange={event => {
console.log(event.target.files);
if (event.target.files) {
const upload_images: tierImage[] = [];
for (let i = 0; i < event.target.files.length; i++) {
const url = URL.createObjectURL(event.target.files[i]);
upload_images.push({
url: url,
name: event.target.files[i].name.replace('.jpeg', ''),
category: '',
});
}
handleAdd(upload_images);
} }
handleAdd(upload_images); }}
} />
}} </div>
/> <TierModal />
<EditTierModal />
</DndContext>
<div className='w-full text-[#dfe6e9] flex flex-row items-center justify-center md:justify-end mt-5 gap-1 md:pe-5'>
<a href='https://git.nwaifu.su/sergey/NwTierList' target='_blank'>
Source Code <GitHub />
</a>
</div> </div>
<TierModal /> </div>
<EditTierModal />
</DndContext>
); );
}; };

View File

@@ -1,5 +1,10 @@
.anime-container:hover { .anime-container:hover, .anime-container:active {
.anime-name { .anime-name {
opacity: 100; opacity: 0;
}
@media(min-width: 768px) {
.anime-name {
opacity: 100;
}
} }
} }

View File

@@ -32,7 +32,7 @@ export const TierImage = ({ image }: ImageProps) => {
> >
<div className={`w-[calc(10rem*.5625)] h-40 relative`}> <div className={`w-[calc(10rem*.5625)] h-40 relative`}>
<img src={image.url} alt={image.name} className='h-full w-full object-cover' /> <img src={image.url} alt={image.name} className='h-full w-full object-cover' />
<div className='w-full bg-slate-500 text-white bg-opacity-70 left-0 top-0 absolute h-full flex justify-center items-center opacity-0 anime-name overflow-hidden p-1 text-center transition duration-500 ease-in-out'> <div className='w-full bg-slate-500 text-white bg-opacity-70 left-0 top-0 absolute h-full flex justify-center items-center md:opacity-0 anime-name overflow-hidden p-1 text-center transition duration-500 ease-in-out text-sm break-all'>
{image.name.length > 30 ? image.name.slice(0, 30) + '...' : image.name} {image.name.length > 30 ? image.name.slice(0, 30) + '...' : image.name}
</div> </div>
</div> </div>

View File

@@ -1,3 +1,7 @@
@tailwind base; @tailwind base;
@tailwind components; @tailwind components;
@tailwind utilities; @tailwind utilities;
:root {
background-color: #2d3436;
}