Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Like button for sketches #80

Open
2 of 4 tasks
anandology opened this issue Dec 15, 2021 · 3 comments
Open
2 of 4 tasks

Like button for sketches #80

anandology opened this issue Dec 15, 2021 · 3 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@anandology
Copy link
Contributor

anandology commented Dec 15, 2021

It would be nice to add like buttons to sketches. That'll help us surface the popular sketches and also incentivizes the students to share them on social media.

Stories

As a student, i should be able to like sketches made by others (or even my own sketch).

  • I should be able to like a sketch from the skecthes page and on sketch details page
  • I should be able to unlike a sketch that I've liked before
  • I should be able to see all the sketched that I've liked on a web page
  • I should be able to see how many people liked a sketch on the skecthes page and sketch details page
@anandology anandology added the help wanted Extra attention is needed label Dec 15, 2021
@nikochiko
Copy link
Contributor

I'd like to pick this up

@nikochiko
Copy link
Contributor

nikochiko commented Dec 20, 2021

After a bit of thought and exploring around Frappe, here's one way to go about implementing this:

  • Have a separate LMS Sketch Like DocType.
    • One DocField link for the sketch
    • One DocField link for the user who liked the sketch
    • A unique constraint for ('sketch', 'user') - can be added from code using frappe.db.add_unique
  • To like a sketch
    • User must be authenticated
    • User will hit the "like" button on the sketch page (showed as a heart or a thumbs up icon)
    • The like button (toggle button) will either create a new record for the user and sketch in LMS Sketch Like Doctype, or delete the one which exists
    • Number of likes can be gotten by a count query where sketch = ...
  • To unlike a previously liked sketch - the button will be toggle-able
  • All the sketches liked by authenticated user - query with filters for user
  • How many people liked a sketch - use count query with filter for sketch

As for UI, the Likes can be displayed alongside comments on the pages where all the sketches are listed, and above the comments section (i.e. below the sketch) with a large icon. Maybe we can add more buttons (like a share icon there) alongside later.

Figma test (maybe we can figure out a better placement later, maybe something like youtube):
image

@anandology what do you think?

@nikochiko
Copy link
Contributor

If this "Like" feature sounds like something we'll need to have for other doctypes as well, we can create a dynamic link to the doctype being liked and make it work that way.

anandology added a commit that referenced this issue Jan 11, 2022
Address #80: Like button for sketches
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants