jguddas / lucide-studio

https://lucide-studio.vercel.app
8 stars 2 forks source link

Add tags validation? #2

Closed peteruithoven closed 1 week ago

peteruithoven commented 1 week ago

First of all, Lucide studio is great. It makes it much easier to submit icons and raises their quality.

I just noticed that the tags section could use some validation. Maybe prevent comma separated tags on one line from being submitted? Screenshot from 2024-10-12 15 41 17@2x

I assume tags can't have spaces or comma's? It's not formally defined in the guidelines: https://lucide.dev/guide/design/icon-design-guide#json-metadata-descriptor

peteruithoven commented 1 week ago

Seeing you're already using zot, it could be a matter of adding something like:

tags: z.string().nonempty("Tags are required.").regex(/^[a-z0-9-]+$/, "Tags must contain only lowercase letters, numbers, or hyphens (no underscores, spaces, or special characters)."),

To FormStepMetadata.tsx.

jguddas commented 1 week ago

I don't think we can be that strict, there are a bunch of tags that would now become invalid.

$ jq -r '.tags[]' icons/*.json | grep -v '^[0-9a-z-]*$' | sort | uniq
!
¢
$
£
¥
%
&
&&
(
)
*
+
÷
->
->|
.
...
/
16:9
1:1
4:3
9:16
<
<-
<-|
<>
=
>
?
@
Ø
[
]
^
air conditioner
air conditioning
air freshener
alcohol free
always on top
amusement park
angular frequency
animal rights
application form
artificial intelligence
aspect ratio
audio video
augmented reality
auto theme
bachlor's
backing track
bad egg
beach ball
bezier curve
big wheel
blood pressure
bok choy
brightness low
bubble gum
cache busting
calculating machine
caps lock
car key
car park
carbon monoxide
central air
chewing gum
closed captions
code review
cold storage
color picker
command line
commit graph
computer virus
continuous integration
control panel
control stick
cover letter
crescent moon
cross out
curly braces
curly brackets
curriculum vitae
cut here
daisy wheel
data fluctuation
data leak
deep learning
delivery error
dish aerial
document structure
drop cap
dynamical systems
egg free
eighth note
electrical resistance
emergency exit
emergency room
et cetera
exclamation mark
exit fullscreen
eye dropper
fast food
felt tip
field glasses
fire alarm
first aid
floppy disk
floppy disks
font size
foot soldier
full stop
glob pattern
gluten free
gmo free
golf course
graphic equaliser
half note
haptic feedback
hard disk
hard of hearing
hearing loss
heart rate monitor
hedge fund
high school
home cinema
home video
hop free
horizontal rule
ice cream
ice lolly
iced bun
icing sugar
indicate turn
integrated circuit
intensive care
junk food
key ring
knowledge base
lactose free
land worker
less than
level up
life belt
lock screen
machine learning
magnifying glass
mailing list
marker pens
master's
menu bar
mobile data
mobile home
more than
motion picture
multiple choice
native american
nautical mile
near-field communication
no parking
node.js
non toxic
nucleic acid
ocean liner
paper aeroplane
paper airplane
parking lot
period break
personal information
pest control
phone numbers
plain language
pocket money
pop out
power lines
price tag
product process
property list
push api
quantity surveyor
quarter note
question mark
quick link
random access
reading list
real estate
richter scale
roller blind
school bell
screen share
shaving foam
sign in
sign out
sixteenth note
ski lift
small print
social media
soft boiled
soy free
space station
speech bubble
speech bubbles
square meter
square metres
stick figure
sugar free
supply chain
surface area
swiss army knife
system theme
table service
telegraph pole
theme park
this way up
time machine
toaster oven
transmission line
trend flat
trending down
trending up
tumble dryer
tv remote
valentines day
version control
virtual machine
virtual private network
vital signs
winter holiday
working out
{
|->
|<-
}
°
…
₣
€
₹
₽
≠
🎉
🎊
jguddas commented 1 week ago

What we could do is auto split when you type ,.

jguddas commented 1 week ago

I have added a simple .replaceAll(', ', '\n') as a fix for this.

https://github.com/user-attachments/assets/a11b6d3d-5ad6-4fc7-bff8-30f72496522d

peteruithoven commented 1 week ago

Nice! Only downside I see is that when the user's adds a comma not at the end, their cursor is moved to the end. But that's a bit of an edge case.