rudzainy / ranting

A hyper localised link-in-bio platform.
https://ranting-mvp.onrender.com
0 stars 0 forks source link

User can shorten links. #51

Closed rudzainy closed 7 months ago

rudzainy commented 9 months ago
hewrin commented 9 months ago

Should I copy how bitly does it? Screenshot 2024-02-11 at 1 21 20 AM

hewrin commented 9 months ago

Would these shortened links be a separate ActiveRecord model from the link model in Ranting currently?

rudzainy commented 9 months ago

Would these shortened links be a separate ActiveRecord model from the link model in Ranting currently?

Dayum that's a good question. Comparing them:

A: link have many short_links

B: link has a short_link column

I think it should not be separated if we want to keep things simple🤔

I also think there's much more we can explore with short link IN THE FUTURE 😂

rudzainy commented 9 months ago

Should I copy how bitly does it?

Screenshot 2024-02-11 at 1 21 20 AM

Just a simple one like sini.la (which uses https://github.com/YOURLS/YOURLS) 😬

image

hewrin commented 9 months ago

Would these shortened links be a separate ActiveRecord model from the link model in Ranting currently?

Dayum that's a good question. Comparing them:

A: link have many short_links

  • When signed in users create a new link, and create a short_link from that new link, the short_link will reference the link's url as it's long_url.
  • When anonymous user creates a short_link from a custom long_url, well nothing else needs to be done here...

B: link has a short_link column

  • When anonymous user creates a short_link from a custom long_url, a new link will be created with no user associated, or assigned to an anonymous or an admin or a system user account.
  • Index pages for link and short_link will call from the same AR model and filtered accordingly.

I think it should not be separated if we want to keep things simple🤔

I also think there's much more we can explore with short link IN THE FUTURE 😂

I think we should go with link has_many short_links, Seems a bit more flexible for things we can explore IN THE FUTURE.

But then for anonymous_users, everytime they create a short_link it creates a new_link right?

hewrin commented 9 months ago

Should I copy how bitly does it? Screenshot 2024-02-11 at 1 21 20 AM

Just a simple one like sini.la (which uses https://github.com/YOURLS/YOURLS) 😬

image

Actually for existing links, shouldn't it just be a button? Then we will create a short_link associated with it?

rudzainy commented 9 months ago

But then for anonymous_users, everytime they create a short_link it creates a new_link right?

Yes. This is one drawback i don't prefer. Do u think it will add too many unnecessary complexity?

An alternative is to add a column in short_url called something like long_url...

hewrin commented 9 months ago

Yes. This is one drawback i don't prefer. Do u think it will add too many unnecessary complexity?

I think if its going to be one off links it should be fine. Each anonymous user short link will need their own special link anyway if they want to view basic statistics

hewrin commented 8 months ago

TODO

Link model

TO DON'T

hewrin commented 8 months ago

Update on ShortLink model

    create_table :short_links do |t|
      t.references :links <-- original url lives here
      t.string :statistics_token <--- token to take user to the statistics page
      t.string :url_token <--- token to add on to our shortener domain eg. suri.li/:url_token
      t.timestamps
    end
hewrin commented 8 months ago
rudzainy commented 8 months ago

User flow

Screenshot 2024-03-15 at 3 57 56 PM

https://www.figma.com/file/HT9fjCTYdeqN9XvnIPbnwZ/Untitled?type=whiteboard&node-id=0%3A1&t=0g7Ap2b5Ya9tYoDf-1

hewrin commented 8 months ago

@rudzainy Can close?

rudzainy commented 8 months ago

Will close after i'm done with the UI 🥶

rudzainy commented 8 months ago

@hewrin seems like all short links has a = at the end. do you know why? 🤔

Screenshot 2024-03-29 at 11 36 54 AM
rudzainy commented 7 months ago

Done with #88