Skip to content

Commit

Permalink
Merge pull request #23 from ful1e5/dev
Browse files Browse the repository at this point in the history
v1.0.1
  • Loading branch information
ful1e5 authored Jan 12, 2024
2 parents 3333291 + aa00ebb commit 315b798
Show file tree
Hide file tree
Showing 28 changed files with 425 additions and 224 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [unreleased]

## [v1.0.1] - 12 January 2024

### What's New?

- Right Hand Cursor Mode added
- Download as PNGs Option added
- Interactive Cursor size component
- More polished UI
Expand Down Expand Up @@ -69,7 +72,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Initial public release 🎊

[unreleased]: https://github.com/ful1e5/bibata/compare/v1.0.0...main
[unreleased]: https://github.com/ful1e5/bibata/compare/v1.0.1...main
[v1.0.1]: https://github.com/ful1e5/bibata/compare/v1.0.1...v1.0.0
[v1.0.0]: https://github.com/ful1e5/bibata/compare/v1.0.0...v1.0.0-beta.0
[v1.0.0-beta.0]: https://github.com/ful1e5/bibata/compare/v1.0.0-alpha.1...v1.0.0-beta.0
[v1.0.0-alpha.1]: https://github.com/ful1e5/bibata/compare/v1.0.0-alpha.0...v1.0.0-alpha.1
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ By doing so, you will not only gain access to pro features but also receive all
- [ ] Write tests
- [ ] Migrate project to AWS (Optional)

<!-- Download Counts (08/01/2024) -->
<!-- Bibata Modern Amber 3,703 -->
<!-- Bibata Original Amber 5,307 -->
<!-- Bibata Modern Ice 180,246 -->
<!-- Bibata Original Ice 6,630 -->
<!-- Bibata Modern Classic 21,340 -->
<!-- Bibata Original Classic 8,778 -->
<!-- GitHub 101,547 -->
<!-- ---------------------------------- -->
<!-- Total 327,551 -->

## Copying

This project is released under the terms of the MIT license.
Expand Down
77 changes: 77 additions & 0 deletions core/builder/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,83 @@ def _assign(v) -> int:
self.links = links


rconfigs: Dict[str, Config] = {
"left_ptr": Config(
x=207,
y=24,
winname="Pointer",
xname="left_ptr",
links=["arrow", "default", "top_left_arrow"],
),
"left_ptr_watch": Config(
x=197,
y=24,
winname="Work",
xname="left_ptr_watch",
links=[
"00000000000000020006000e7e9ffc3f",
"08e8e1c95fe2fc01f976f1e063a24ccd",
"3ecb610c1bf2410f44200f48c40d3599",
"progress",
],
),
"right_ptr": Config(
x=55,
y=17,
winname="Alternate",
xname="right_ptr",
links=["draft_large", "draft_small"],
),
"circle": Config(
x=207,
y=24,
winname="Unavailable",
xname="circle",
links=["forbidden"],
),
"context-menu": Config(
x=207,
y=24,
xname="context-menu",
),
"copy": Config(
x=207,
y=24,
xname="copy",
links=[
"1081e37283d90000800003c07f3ef6bf",
"6407b0e94181790501fd1e167b474872",
"b66166c04f8c3109214a4fbd64a50fc8",
],
),
"link": Config(
x=207,
y=24,
xname="link",
links=[
"3085a0e285430894940527032f8b26df",
"640fb0e74195791501fd1ed57b41487f",
"a2a266d0498c3104214a47bd64ab0fc8",
],
),
"pointer-move": Config(
x=207,
y=24,
xname="pointer-move",
),
"person": Config(
x=207,
y=24,
winname="Person",
),
"pin": Config(
x=207,
y=24,
winname="Pin",
),
}


configs: Dict[str, Config] = {
"bd_double_arrow": Config(
winname="Dgn1",
Expand Down
6 changes: 4 additions & 2 deletions core/builder/cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from clickgen.writer import to_win, to_x11
from PIL import Image

from core.builder.config import configs, gsubtmp
from core.builder.config import configs, gsubtmp, rconfigs
from core.utils.parser import UploadFormData


Expand All @@ -18,6 +18,7 @@ def store_cursors(sid: str, data: UploadFormData, logger: Logger):
platform = data.platform
pngs = data.frames
size = data.size
right_mode = data.mode == "right"
delay = data.delay

try:
Expand All @@ -26,6 +27,8 @@ def store_cursors(sid: str, data: UploadFormData, logger: Logger):
return None, errors

config = configs.get(name, None)
if right_mode:
config = rconfigs.get(name, config)
if not config:
raise ValueError(f"Unable to find Configuration for '{name}'")
else:
Expand All @@ -39,7 +42,6 @@ def store_cursors(sid: str, data: UploadFormData, logger: Logger):

if len(pngs) == 1:
f = tmp_dir / f"{name}.png"
logger.info(pngs[0])
img = Image.open(BytesIO(pngs[0]))
img.resize((size, size)).save(f)
else:
Expand Down
12 changes: 12 additions & 0 deletions core/utils/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ class UploadFormData:
platform: str
size: int
delay: int
mode: Literal["left", "right"]
errors: List[str]


def parse_upload_formdata(request: Request, logger: Logger):
errors: List[str] = []

name: str = ""
mode: Literal["left", "right"] = "left"
size: int = 0
delay: int = 0
platform: str = ""
Expand All @@ -32,6 +34,7 @@ def parse_upload_formdata(request: Request, logger: Logger):
raise ValueError("JSON data Not Found at 'data' key in FormData request.")
else:
data = json.loads(form_data)

s = data.get("size", None)
if not s:
raise ValueError("'size' Not Found in JSON 'data' ")
Expand All @@ -58,6 +61,14 @@ def parse_upload_formdata(request: Request, logger: Logger):
else:
platform = p

m = data.get("mode", None)
if m != "left" and m != "right":
raise ValueError(
"Invalid 'mode' type. It must be type 'left' or 'right'"
)
else:
mode = m

n = data.get("name", None)
if not n:
raise ValueError("'name' Not Found in JSON 'data' ")
Expand Down Expand Up @@ -90,6 +101,7 @@ def parse_upload_formdata(request: Request, logger: Logger):
size=size,
delay=delay,
platform=platform,
mode=mode,
errors=errors,
)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "bibata",
"description": "CLI for converting cursor svg files to png.",
"author": "Abdulkaiz Khatri <kaizmandhu@gmail.com>",
"version": "1.0.0",
"version": "1.0.1",
"private": true,
"bugs": {
"url": "https://github.com/ful1e5/bibata/issues",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- AlterEnum
-- This migration adds more than one value to an enum.
-- With PostgreSQL versions 11 and earlier, this is not possible
-- in a single migration. This can be worked around by creating
-- multiple migrations, each migration adding only one value to
-- the enum.


ALTER TYPE "Type" ADD VALUE 'ModernRight';
ALTER TYPE "Type" ADD VALUE 'OriginalRight';
2 changes: 2 additions & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ enum Platform {

enum Type {
Modern
ModernRight
Original
OriginalRight
}

model User {
Expand Down
31 changes: 24 additions & 7 deletions src/app/(home)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import '@app/(home)/styles.css';
import Link from 'next/link';

import { Message } from '@components/Message';
import { AnimatedCounter } from '@components/AnimatedCount';
import { AnimatedCounter as Counter } from '@components/AnimatedCount';
import { BibataMarquee } from '@components/BibataMarquee';
import { Heroes } from '@components/Heroes';
import {
Expand All @@ -14,6 +14,7 @@ import {
LinuxDownloadSVG,
LinuxMintLogo,
ManjaroLogo,
PNGsDownloadSVG,
WindowsDownloadSVG
} from '@components/svgs';

Expand Down Expand Up @@ -140,7 +141,7 @@ export default function HomePage() {
<path d='M24 12c0-6.627-5.373-12-12-12s-12 5.373-12 12 5.373 12 12 12 12-5.373 12-12zm-18 1h4v-7h4v7h4l-6 6-6-6z' />
</svg>
<h4>
<AnimatedCounter number='121' duration={2} />
<Counter number='327' duration={5} />
K+
</h4>
</div>
Expand Down Expand Up @@ -192,7 +193,7 @@ export default function HomePage() {
<h1 className='section-heading'>Supported Platforms</h1>

<div className='flex justify-center items-center'>
<div className='w-full mt-10 p-5 grid grid-cols-1 sm:grid-cols-2 gap-5 md:gap-20'>
<div className='w-full mt-10 p-5 grid grid-cols-1 lg:grid-cols-3 gap-5 md:gap-20'>
<div className='platform-card bg-white/[.1]'>
<span className='platform-icon'>
<LinuxDownloadSVG />
Expand All @@ -219,6 +220,20 @@ export default function HomePage() {
interface.
</p>
</div>

<div className='platform-card bg-white/[.1]'>
<span className='platform-icon'>
<PNGsDownloadSVG />
</span>

<h4 className='platform-heading'>Cursor Bitmaps</h4>
<p className='platform-line'>
Bibata Studio specializes in designing top-notch PNG cursor
bitmaps, showcasing personalized color schemes, animated
sequences, and tailor-made dimensions for effortless
integration into games and websites.
</p>
</div>
</div>
</div>
</section>
Expand All @@ -232,17 +247,19 @@ export default function HomePage() {
<Heroes />
<div className='flex justify-center my-3 mt-10'>
<p className='section-subheading w-5/6 sm:w-2/3'>
Bibata is a fully open-source platform with actively maintained
libraries. Join our community of dedicated contributors and become a
hero in advancing our mission.
Bibata stands as a fully open-source platform, boasting actively
maintained libraries. Elevate your involvement by joining our
community at the tier exceeding $5 per month, where dedicated
contributors have the opportunity to play a heroic role in advancing
our mission.
</p>
</div>

<div className='mt-6 flex-center flex-col sm:flex-row gap-2 sm:gap-5 md:gap-10 font-black'>
<Link
className='heading-button selected-button scale-animation'
href='https://github.com/sponsors/ful1e5'>
Join As Sponsor
Become a Hero
</Link>

<Link
Expand Down
11 changes: 7 additions & 4 deletions src/app/(home)/studio/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { Image } from 'bibata/app';

export default function StudioPage() {
const [type, setType] = useState(TYPES[0]);
const [cursorMode, setCursorMode] = useState<'left' | 'right'>('left');
const [cursorSize, setCursorSize] = useState(SIZES[3]);

const [colorName, setColorName] = useState('Amber');
Expand Down Expand Up @@ -71,12 +72,13 @@ export default function StudioPage() {
/>
<div className='mt-5'>
<TypePicker
list={TYPES}
list={TYPES.filter((a) => !a.match('Right'))}
value={type}
onClick={(v) => {
if (v !== type) {
onChange={(t, rhm) => {
if (t !== type) {
resetImages();
setType(v);
setType(t);
setCursorMode(rhm ? 'right' : 'left');
refreshToken();
}
}}
Expand Down Expand Up @@ -114,6 +116,7 @@ export default function StudioPage() {
<DownloadButton
auth={token}
version={version}
mode={cursorMode}
disabled={images.length === 0}
lock={imagesCount === 0 || imagesCount !== images.length}
config={{
Expand Down
Loading

0 comments on commit 315b798

Please sign in to comment.