algora-io / tv

Open source Twitch for developers
https://algora.tv
Other
1.08k stars 69 forks source link

feat: tag system for videos and channels #92

Open kaf-lamed-beyt opened 2 months ago

kaf-lamed-beyt commented 2 months ago

@zcesur this is still a work in progress. I want to start working on the controllers. I got the migrations to work. It was my fault after all.

But, please have a look and let me know if I'm on the right path.

/claim #70

kaf-lamed-beyt commented 2 months ago

So this is what I have currently, @zcesur.

Screenshot from 2024-09-13 08-32-59

Although, there's a slight issue. Whenever I press enter, It shows the "Settings updated" toast. So I guessed it was because I was updating the socket immediately like so:

     send(self(), {:updated_tags, updated_tags})

I removed that line, and the same thing still happens.

I've only been able to do this for user (channel) via their settings. I don't know where to place the component for videos.

zcesur commented 2 months ago

Hey @kaf-lamed-beyt, component looks great!

Whenever I press enter, It shows the "Settings updated" toast.

Sounds like it's triggering a form submission, why don't we use another key like Space instead of Enter?

I've only been able to do this for user (channel) via their settings. I don't know where to place the component for videos.

We don't need a separate input for videos, they should just inherit user's current tags when they're created

kaf-lamed-beyt commented 2 months ago

Hey @kaf-lamed-beyt, component looks great!

Ayy! Thanks!

Sounds like it's triggering a form submission, why don't we use another key like Space instead of Enter?

Oh okay, I'll adjust this.

We don't need a separate input for videos, they should just inherit user's current tags when they're created

Okay, great!

kaf-lamed-beyt commented 2 months ago

updated this too @zcesur

zcesur commented 2 months ago

We'll need to clear the input after space, otherwise previous inputs are added into subsequent tags

kaf-lamed-beyt commented 2 months ago

ah! true! I tried setting the input value to an empty string after the add_tag event runs, I don't know it didn't work. I'll look at it again.

kaf-lamed-beyt commented 2 months ago

I had to go read up on elixirforum on why the input wasn't clearing. Apparently, it is a bit related to a LiveView issue since the field is not in a form. So, I had to use a hook to clear the field.

Screencast from 27-09-2024 19:55:41.webm

You can review again, @zcesur

zcesur commented 1 month ago

Tag input works great! Video tags don't seem to inherit user tags though:

select id, tags from users where id = 2;
--  id |       tags
-- ----+------------------
--   2 | {elixir,typescript}
select id, user_id, tags from videos order by id desc limit 1;
--  id | user_id | tags
-- ----+---------+------
--  42 |       2 | {}
kaf-lamed-beyt commented 1 month ago

Huh! Okay, I'll have a look at this now.

kaf-lamed-beyt commented 1 month ago

@zcesur, I've updated this. Kindly review.

I ran the query without the limit

 id  | user_id |              tags              
-----+---------+--------------------------------
 127 |       1 | {typescript,zig,lua,sol,makin}
 126 |       1 | {typescript,zig,lua,sol,makin}
 125 |       2 | 
 124 |       2 | 
 123 |       2 | 
 122 |       2 | 
 121 |       2 | 
 120 |       2 | 
 119 |       1 | {typescript,zig,lua,sol,makin}
 118 |       1 | {typescript,zig,lua,sol,makin}
 117 |       1 | {typescript,zig,lua,sol,makin}
 116 |       1 | {typescript,zig,lua,sol,makin}
 115 |       1 | {typescript,zig,lua,sol,makin}
 114 |       1 | {typescript,zig,lua,sol,makin}
 113 |       1 | {typescript,zig,lua,sol,makin}
 112 |       1 | {typescript,zig,lua,sol,makin}
 111 |       1 | {typescript,zig,lua,sol,makin}
 110 |       1 | {typescript,zig,lua,sol,makin}
 109 |       1 | {typescript,zig,lua,sol,makin}
 108 |       1 | {typescript,zig,lua,sol,makin