giuseppelt / feelback-integrations

Feelback SDKs, integrations libraries and samples
https://www.feelback.dev
MIT License
33 stars 1 forks source link

bug astro FeelbackReaction #3

Closed danieljsaldana closed 1 year ago

danieljsaldana commented 1 year ago

It already compiles, but there is the same bug as in 2.x and that is that only the feel face icon works. The rest indicates that the value you are trying to send back does not seem to be valid.

I am using FeelbackReaction and github icons

Thank you very much for your response so quickly!

image
giuseppelt commented 1 year ago

Sorry for the inconvenience. Can you send me the contentSetId and the snippet you used in your site? the `<FeelbackReaction ... />

danieljsaldana commented 1 year ago

Clear! Here I leave it!

Thank you so much!

import "astro-feelback/styles/feelback.css";
import FeelbackReaction from "astro-feelback/components/FeelbackReaction.astro";
          <FeelbackReaction 
            contentSetId=""
            preset="github"
            showCount
          />    
giuseppelt commented 1 year ago

You have the contentSetId=""? You need to set to the id from the panel. image

danieljsaldana commented 1 year ago

correct, I have put it. I just removed it for security

giuseppelt commented 1 year ago

Hi, I looked up the content set 050792cc-... You configured custom values ["like", "love", "laugh", "wow", "sad", "angry"], so you cannot use the preset "github" on the client side. It defines different values that don't match.

What you have to do is to put your own "Reactions". Then you have to pass that with the preset prop.

---
import type { FeelbackValueDefinition } from "astro-feelback";
import FeelbackReaction from "astro-feelback/components/FeelbackReaction.astro";
import LikeIcon from "astro-feelback/icons/icon-like.svg?raw";

const CONTENT_SET_ID = "....";
const REACTIONS: FeelbackValueDefinition[] = [
  { value: "like", icon: LikeIcon }, // use builtin icons from the package... it's just HTML
  { value: "love", icon: "😍" }, // or you can pass a string, with an emoji or anything you want
  { value: "laugh", icon: "🤣" },
];
---

<FeelbackReaction contentSetId={CONTENT_SET_ID} preset={REACTIONS} />

So you have to define them manually, if you used custom values. Let me know if this works.

danieljsaldana commented 1 year ago

Correct, it works now! thank you so much

danieljsaldana commented 1 year ago

One question, it is normal that when preloading the page the number of interactions disappears.

I also see that it does not matter if you mark the same icon several times than when you mark it, 1 always appears

danieljsaldana commented 1 year ago

Basically when I enter the page and press it defines 1. But when I reload the page and click again on the same reaction it subtracts 1. At the cookie level it seems to remember it.

giuseppelt commented 1 year ago

1) The interaction number is loaded on page load, because you don't know that number when you build your site. It can be on production for days, so the number needs to be updated on page load.

2) That happens because Feelback is smart : ). Reactions from the same user (for the same content), don't add up. This allows also for changing your reaction, for example you misclicked. This "changing ability" works for an interval, let say 15min. In this interval, you can change it. After that, it freezes and you cannot change it. It will be "active" and "disabled". In addition, another feature Feelback provides, it has "expiration". That is, after a while, the reaction for the user is not stored anymore, so he can add a new reaction. For example, if the user visit the same blog post after a week, he can add a new reaction, the past one won't be overwriten. The past one, still is memorized, and still count in the total interaction.

Let me know if this makes sense

giuseppelt commented 1 year ago

I'm closing this. If there's something more you can also reach me at support@feelback.dev or at giuseppelt on discord.