diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c564fa..58ced5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - More polished UI - Custom `404` (not-found) page - Using `geist` fonts +- Button Click Animation added +- Using clickgen v2.2.0 for building Cursors + +### Fixes + +- Slow animation in Windows Cursors ## [v1.0.0] - 30 December 2023 diff --git a/core/builder/compress.py b/core/builder/compress.py index d1b1755..ba34fda 100644 --- a/core/builder/compress.py +++ b/core/builder/compress.py @@ -24,7 +24,7 @@ def win_compress(id: str, param: DownloadParams, logger: Logger) -> FileResponse errors: List[str] = [] dir = gsubtmp(id) - name = f"{param.name}-{dir.stem.split('-')[1]}-v{param.version}" + name = f"{param.name}-{dir.stem.split('-')[1]}-v{param.version}-{param.platform}" fp = gtmp(id) / f"{name}.zip" if not fp.exists(): @@ -56,7 +56,7 @@ def png_compress(id: str, param: DownloadParams, logger: Logger) -> FileResponse errors: List[str] = [] dir = gsubtmp(id) - name = f"{param.name}-{dir.stem.split('-')[1]}-v{param.version}" + name = f"{param.name}-{dir.stem.split('-')[1]}-v{param.version}-{param.platform}" fp = gtmp(id) / f"{name}.zip" if not fp.exists(): @@ -81,7 +81,7 @@ def x11_compress(id: str, param: DownloadParams, logger: Logger) -> FileResponse errors: List[str] = [] dir = gsubtmp(id) - name = f"{param.name}-{dir.stem.split('-')[1]}-v{param.version}" + name = f"{param.name}-{dir.stem.split('-')[1]}-v{param.version}-{param.platform}" fp = gtmp(id) / f"{name}.tar.gz" if not fp.exists(): diff --git a/core/builder/cursor.py b/core/builder/cursor.py index 44c46b8..ed3307c 100644 --- a/core/builder/cursor.py +++ b/core/builder/cursor.py @@ -1,9 +1,11 @@ import os +from io import BytesIO from logging import Logger from typing import List from clickgen.parser import open_blob from clickgen.writer import to_win, to_x11 +from PIL import Image from core.builder.config import configs, gsubtmp from core.utils.parser import UploadFormData @@ -37,42 +39,45 @@ def store_cursors(sid: str, data: UploadFormData, logger: Logger): if len(pngs) == 1: f = tmp_dir / f"{name}.png" - f.write_bytes(pngs[0]) + logger.info(pngs[0]) + img = Image.open(BytesIO(pngs[0])) + img.resize((size, size)).save(f) else: max_digits = len(str(len(pngs))) for i, png in enumerate(pngs): index = f"{i + 1:0{max_digits}}" f = tmp_dir / f"{name}-{index}.png" - f.write_bytes(png) - else: - blob = open_blob(pngs, (config.x, config.y), [size], delay) + img = Image.open(BytesIO(png)) + img.resize((size, size)).save(f) - if platform == "win" and config.winname: - ext, cur = to_win(blob.frames) - cursor_name = config.winname + if platform == "win" and config.winname: + blob = open_blob(pngs, (config.x, config.y), [size], 1) + ext, cur = to_win(blob.frames) + cursor_name = config.winname - tmp_dir = gsubtmp(sid) / "cursors" - tmp_dir.mkdir(parents=True, exist_ok=True) - f = tmp_dir / f"{cursor_name}{ext}" - f.write_bytes(cur) + tmp_dir = gsubtmp(sid) / "cursors" + tmp_dir.mkdir(parents=True, exist_ok=True) + f = tmp_dir / f"{cursor_name}{ext}" + f.write_bytes(cur) - if platform == "x11" and config.xname: - cur = to_x11(blob.frames) - cursor_name = config.xname + if platform == "x11" and config.xname: + blob = open_blob(pngs, (config.x, config.y), [size], delay) + cur = to_x11(blob.frames) + cursor_name = config.xname - tmp_dir = gsubtmp(sid) / "cursors" - tmp_dir.mkdir(parents=True, exist_ok=True) + tmp_dir = gsubtmp(sid) / "cursors" + tmp_dir.mkdir(parents=True, exist_ok=True) - xname = f"{cursor_name}{ext}" - f = tmp_dir / xname - f.write_bytes(cur) + xname = f"{cursor_name}{ext}" + f = tmp_dir / xname + f.write_bytes(cur) - if config.links: - oldpwd = os.getcwd() - os.chdir(tmp_dir) - for link in config.links: - os.symlink(xname, link) - os.chdir(oldpwd) + if config.links: + oldpwd = os.getcwd() + os.chdir(tmp_dir) + for link in config.links: + os.symlink(xname, link) + os.chdir(oldpwd) except Exception as e: errors.append(str(e)) diff --git a/requirements.txt b/requirements.txt index 655c338..15b9558 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ Flask==3.0.0 python-dotenv===1.0.0 PyJWT===2.8.0 -clickgen===2.1.9 +clickgen===2.2.0 diff --git a/src/app/(home)/styles.css b/src/app/(home)/styles.css index 5769958..4de6a32 100644 --- a/src/app/(home)/styles.css +++ b/src/app/(home)/styles.css @@ -17,7 +17,7 @@ @apply text-lg text-center font-light text-white/[.7]; } .heading-button { - @apply flex gap-2 px-5 sm:px-12 py-3 sm:py-5 rounded-full uppercase; + @apply flex gap-2 px-5 sm:px-12 py-3 sm:py-5 rounded-full uppercase transition active:scale-95; } .selected-button { @@ -79,7 +79,7 @@ /* Open Source & Libraries */ .library-card { - @apply rounded-3xl p-6 flex flex-col transform hover:scale-105 ease-in-out duration-150 hover:bg-[#8aa8f2]/[.2]; + @apply rounded-3xl p-6 flex flex-col transform hover:scale-105 ease-in-out duration-150 hover:bg-[#8aa8f2]/[.2] transition active:scale-95; } .library-card-heading { @apply md:text-2xl font-bold; diff --git a/src/components/ColorPicker/index.tsx b/src/components/ColorPicker/index.tsx index 091b7e1..b6ddf1f 100644 --- a/src/components/ColorPicker/index.tsx +++ b/src/components/ColorPicker/index.tsx @@ -28,7 +28,7 @@ export const ColorPickerButton: React.FC = (props) => { @@ -286,7 +286,7 @@ export const ColorPickerModal: React.FC = (props) => {
diff --git a/src/components/Cursors/card.tsx b/src/components/Cursors/card.tsx index ad66e03..9e8a8b6 100644 --- a/src/components/Cursors/card.tsx +++ b/src/components/Cursors/card.tsx @@ -151,6 +151,11 @@ Report Issue here: https://github.com/ful1e5/bibata/issues` return (
{isAnimated && ( -
-
- {`${delayX}x`} -
+
+ {Object.entries(DELAYS).map(([i]) => { + const selected = delayX === parseInt(i); + return ( +
+ {selected ? ( + <>{`${i}x`} + ) : ( +
+ )} +
+ ); + })}
)}
diff --git a/src/components/DownloadButton/index.tsx b/src/components/DownloadButton/index.tsx index a2de184..2176048 100644 --- a/src/components/DownloadButton/index.tsx +++ b/src/components/DownloadButton/index.tsx @@ -44,7 +44,8 @@ export const DownloadButton: React.FC = (props) => { const [loading, setLoading] = useState(false); const [lock, setLock] = useState(false); - const [loadingText, setLoadingText] = useState('Preparing...'); + const defaultLoadingText = 'Collecting Bitmaps...'; + const [loadingText, setLoadingText] = useState(defaultLoadingText); const [errorLogs, setErrorLogs] = useState({ text: '' }); const [showDropdown, setShowDropdown] = useState(false); @@ -170,9 +171,13 @@ export const DownloadButton: React.FC = (props) => { printError(upload.error); await api.refreshSession(token); } else { - setLoadingText( - `Packaging ${platform === 'win' ? 'Win Cursors' : 'XCursors'} ...` - ); + if (platform === 'win') { + setLoadingText('Packaging Windows Cursors ...'); + } else if (platform === 'png') { + setLoadingText('Compressing PNG files ...'); + } else { + setLoadingText('Packaging XCursors ...'); + } const file = await api.download(platform, n, props.version); @@ -191,6 +196,7 @@ export const DownloadButton: React.FC = (props) => { } setLoading(false); + setLoadingText(defaultLoadingText); setLock(false); }; @@ -232,9 +238,9 @@ export const DownloadButton: React.FC = (props) => { ? 'Download locked while collecting cursor images.' : 'Download' } - className='relative flex justify-center items-center uppercase gap-2 w-4/5 sm:w-1/3 lg:w-1/5 h-16 sm:h-20 rounded-full bg-green-600 hover:bg-green-500' - disabled={props.disabled && !lock && !props.lock} - onClick={() => !props.lock && setShowDropdown(!showDropdown)}> + className='relative flex justify-center items-center uppercase gap-2 w-4/5 sm:w-1/3 lg:w-1/5 h-16 sm:h-20 rounded-full bg-green-600 transition hover:scale-105 active:scale-90 hover:bg-green-500' + disabled={props.disabled && !lock} + onClick={() => setShowDropdown(!showDropdown)}> {props.lock ? ( ) : busy ? ( @@ -254,15 +260,13 @@ export const DownloadButton: React.FC = (props) => {
- {loading ? ( - <> -
-
- -
-

{loadingText}

+ {props.lock || loading ? ( +
+
+
- +

{loadingText}

+
) : ( <> = (props) => {
) : ( diff --git a/src/components/TypePicker.tsx b/src/components/TypePicker.tsx index 4dc3fd9..5ac64d5 100644 --- a/src/components/TypePicker.tsx +++ b/src/components/TypePicker.tsx @@ -22,10 +22,10 @@ export const TypePicker: React.FC = (props) => { title={`Bibata ${t}`} disabled={t === props.value} onClick={() => props.onClick(t)} - className={`py-2 flex justify-center items-center gap-1 font-bold border rounded-full shadow-md border-white/[.2] transition ${ + className={`py-2 flex justify-center items-center gap-1 font-bold border rounded-full shadow-md border-white/[.2] transition active:scale-90 ${ t === props.value ? 'bg-white fill-black text-black font-bold' - : 'fill-white/[.4] text-white/[.4] hover:text-white hover:fill-white hover:border-white ' + : 'fill-white/[.4] text-white/[.4] hover:text-white hover:fill-white hover:border-white' }`}> <> {t === 'Modern' && }