This is why you'll want the Notifications API

Sdílet
Vložit
  • čas přidán 1. 02. 2024
  • My Courses
    📘 T3 Stack Tutorial: 1017897100294.gumroad.com/l/j...
    My Products
    📖 ProjectPlannerAI: projectplannerai.com
    🤖 IconGeneratorAI: icongeneratorai.com
    📝 ThumbnailCritique: thumbnailcritique.com
    Useful Links
    💬 Discord: / discord
    🔔 Newsletter: newsletter.webdevcody.com/
    📁 GitHub: github.com/webdevcody
    📺 Twitch: / webdevcody
    🤖 Website: webdevcody.com
    🐦 Twitter: / webdevcody
    arrow in thumbnail www.vecteezy.com/free-vector/... - Abstract Vectors by Vecteezy

Komentáře • 62

  • @sriganeshnagaraj9626
    @sriganeshnagaraj9626 Před 5 měsíci +15

    Nice video Cody! Another improvement could be using service worker to send the notification when the site is not opened in any of the tabs.

  • @nhathuyle9437
    @nhathuyle9437 Před 5 měsíci

    Mann, I've been looking for this implementation for a long time. You are life saver.

  • @nazarshvets7501
    @nazarshvets7501 Před 5 měsíci

    Thanks for great content. Always on time when in my project simillar feature is planed after several sprints. I'm amazed

  • @kashmirtechtv2948
    @kashmirtechtv2948 Před 3 měsíci +1

    Bro your video ideas look real world and that's awesome ❤️

  • @rahim.tn99
    @rahim.tn99 Před 5 měsíci

    as always, short video straight to the point and we learn smth new ❤

  • @keshavakumar9828
    @keshavakumar9828 Před 5 měsíci

    I was about to sleep now i want to build this notification in my next app as well. Good night cody!

  • @SeibertSwirl
    @SeibertSwirl Před 5 měsíci +5

    Good job babe!!! ❤

  • @cas818028
    @cas818028 Před 5 měsíci +6

    The problem with a lot of these solutions is that a user must grant permissions. And almost nobody does that. Everyone is too scared from years of website spamming and popups

    • @CadisDiEtrama000
      @CadisDiEtrama000 Před 5 měsíci +1

      Agreed... I don't think I ever allowed any site ever to give me notifications 😂

    • @WebDevCody
      @WebDevCody  Před 5 měsíci +2

      well, then in that case I guess a user wouldn't find this web application as useful if they disable all their notifications. If you're using a web application that has built in notifications, I'm not sure why you'd disable alerts for the website to hinder your own user experience.

    • @cas818028
      @cas818028 Před 5 měsíci +2

      @@WebDevCody because most web apps don’t have this. It’s such a foreign concept. Whenever that ugly looking permission dialog pops up in chrome users are trained to just dismiss it. I think most people are trained to receive realtime updates and notifications in a different way. For example a bell icon that highlights and when you click it a drawer slides out with your notifications. Basically a notification drawer….

    • @2penry2
      @2penry2 Před 5 měsíci

      In past experience, I've made notifications opt-in when a user clicks a button about enabling said feature. If they've rejected the permissions previously I show a little modal explaining how to grant the permissions.
      Gives the user a bit more confidence in the purpose of the notifications, too often sites are just using it for marketing spam.

  • @JS_Jordan
    @JS_Jordan Před 5 měsíci

    Thumbnails on fire dude 🔥 thnx for the vid

  • @rand0mtv660
    @rand0mtv660 Před 5 měsíci +2

    I noticed that Notification constructor supports "icon" and "badge" properties along with "image". One of those two might actually allow you to replace the notification image so you can try. I never used the API myself. Looking at MDN, "icon" seems to be the most supported property, "badge" less supported and "image" is actually marked as an experimental API.

  • @ultrahash
    @ultrahash Před 5 měsíci +2

    my 5 min well spent.
    knowledge = knowledge + new Knowledge(Browser Notification API)
    memory saved.

  • @st-jn2gk
    @st-jn2gk Před 5 měsíci +11

    How did you get so good at design? I'm really really bad, and I know you used ShadCN, but are you required to sort of "come up" with the UI's you build at work? (and hence got better at that through rough repetition) Or do you do low fidelity sketches on paper or excalidraw etc?

    • @gabrieldavid15
      @gabrieldavid15 Před 5 měsíci +4

      I recommend Refactoring UI book. It's an easy read and pretty straightforward for developers. You'll not learn everything but it's a good start. Also spend some time looking into good UI, with time you develop a "feeling" of what to do.

    • @st-jn2gk
      @st-jn2gk Před 5 měsíci

      Will do! is "Good UI" a book/course or did you just mean UI that is good?
      @@gabrieldavid15

    • @nazarshvets7501
      @nazarshvets7501 Před 5 měsíci +1

      Dont worry, I have designers on my team, and when new UI is needed, they just go to look at websites(to competitors) for "inspiration" 💅
      As far as I understand, this is best practice in design world

    • @WebDevCody
      @WebDevCody  Před 5 měsíci +3

      Hosna, another youtuber I'm working on this with, is the one does most of the design improvements. We often start with the default shadcn components, but then we'll come through and improve them as needed after we've used the application a bit and find areas that could be improved. A lot of design comes from looking at other online services and taking the best from each one.

  • @aseemlalfakawma5084
    @aseemlalfakawma5084 Před 4 měsíci

    You can also use FCM for notifications. And it's free. Great vid btw.

  • @notril5460
    @notril5460 Před 5 měsíci

    Cool. Will tinker with it when i make my app pwa

  • @onsjannet5558
    @onsjannet5558 Před 5 měsíci

    dude you made me a better dev, thx

  • @oSpam
    @oSpam Před 5 měsíci +1

    Hey Cody! Any chance we could get a "system design" type video like normal but about the Teams functionality? I'd be nice to see how you implemented it! Did you keep the same page code to work with individuals + teams or use separate, things like that! Great video though :)

  • @InsanelyGraphical
    @InsanelyGraphical Před 5 měsíci

    Could you do video on the organization/team setup and system design

  • @user-jm1qz4dj9l
    @user-jm1qz4dj9l Před 5 měsíci

    Could you make a video showing all your extensions?

  • @kakun7238
    @kakun7238 Před 5 měsíci

    and what about the firebase messaging and the service workers i dont understand that

  • @eshw23
    @eshw23 Před 5 měsíci

    Hey Cody(or anyone else), when your in the workforce like this, is building projects still a great way to improve? Or should efforts be more focused towards the job?

    • @WebDevCody
      @WebDevCody  Před 5 měsíci +1

      building larger projects is always been a great way to improve. sometimes just tinkering on smaller things to learn new tooling is important as well.

  • @davidsiewert8649
    @davidsiewert8649 Před 5 měsíci +2

    Do you really use it anywhere, on any other website?
    I do not know a single person using it.
    As I know it all websites have trained us to always press ignore/disallow them.

    • @WebDevCody
      @WebDevCody  Před 5 měsíci +3

      I use it on any website that is actually related to my real work; but any random site that asks for notifications randomly, no. For example, slack web, discord web, yes I'd turn that on.

    • @davidsiewert8649
      @davidsiewert8649 Před 5 měsíci

      @@WebDevCody
      Ah... I remember now.
      I disabled notification completely.
      So that websites do not even have the capability to ask.
      I can enjoy peace and quite and completely forget that they even exist.

  • @Goyo_MGC
    @Goyo_MGC Před 5 měsíci

    If I understood correctly, you added your function in your "main" layout.tsx. I saw you used a useEffect, does that mean you have a "use client" at the very top and it converts your whole application to client side rendering ?

    • @younesessaadani9303
      @younesessaadani9303 Před 5 měsíci

      When saying render the children inside a client layout and the children are server side component they act as a server side component but if you render them inside the layout like this it'll act as a client component

    • @Goyo_MGC
      @Goyo_MGC Před 5 měsíci

      @@younesessaadani9303 Not sure i could understand your point. Do you have documentation on this subject ?

    • @WebDevCody
      @WebDevCody  Před 5 měsíci

      yes, there is a use client at the top of that layout. This is a nested layout, and no it won't convert your entire application to client side rendering. Btw you can pass RSC into a client component if you want so that the RSC still renders on the server.

    • @Goyo_MGC
      @Goyo_MGC Před 5 měsíci

      @@WebDevCody Thanks for clarifications, the next documentation lacks a bit of practical examples. I thought everything contained in a client component was converted to client side rendering as stated in the doc (This means that by defining a "use client" in a file, all other modules imported into it, including child components, are considered part of the client bundle.) With both of your explanations I understand now how RSC could be passed to a client component !

  • @adventurer2395
    @adventurer2395 Před 5 měsíci

    is this part of a bigger playlist of a project? can’t find it

  • @2penry2
    @2penry2 Před 5 měsíci

    Take a look at service workers and the WebPush protocol, so you can do notifications even if page isn't open.

    • @WebDevCody
      @WebDevCody  Před 5 měsíci +1

      That’s cool, but that feels like something that would really annoy users maybe? If I’ve closed chrome I wouldn’t except notifications

    • @2penry2
      @2penry2 Před 5 měsíci

      @@WebDevCody I agree, I'll never enable it on sites unless I get value form it, far too many sites use it for spammy marketing. I just mean it might be neat to take a look at it, some users may find it useful. I certainly found it fun to play around with!

    • @user-cv6kf4bk1q
      @user-cv6kf4bk1q Před 5 měsíci

      i thought using WebPush protocol with service worker is one of the way to implement push notifications to user devices when they use their mobile device. (like when you exported to PWA).
      is that right?

    • @2penry2
      @2penry2 Před 5 měsíci

      ​@@user-cv6kf4bk1q Yup you could totally take that approach, but also it's not a hard requirement since most browsers will always have a process running in the background which means the service worker can still receive the notifications.
      So it could still be just a standard website on either desktop or mobile and have notifications when the page isn't open.

  • @kyngcytro
    @kyngcytro Před 5 měsíci

    Awesome stuff. A small concern is that users can spam the notification mutation.

    • @WebDevCody
      @WebDevCody  Před 5 měsíci

      I mean the user needs access to the plan to create messages, and I do have some backend logic which adds padding to the lastRead timestamp so that you have to wait X amount of seconds before it'll show a notification again

    • @kyngcytro
      @kyngcytro Před 5 měsíci

      @@WebDevCody oh I was actually referring to the database write of lastread

    • @kyngcytro
      @kyngcytro Před 5 měsíci

      @@WebDevCodyyou update lastread everytime they view the messages page so multiple requests equals multiple writes or I'm I missing something 🤔

  • @ahmedivy
    @ahmedivy Před 5 měsíci

    You are using real-time db for messages?

  • @aliasgar.burhani1099
    @aliasgar.burhani1099 Před 5 měsíci

    How do I keep the sockets running even when the tab or browser is closed and receive notifications?

    • @WebDevCody
      @WebDevCody  Před 5 měsíci

      That might need service workers?

    • @aliasgar.burhani1099
      @aliasgar.burhani1099 Před 5 měsíci

      Thank you so much. This solution just didn't come to my naive mind . Love from India ❤

    • @2penry2
      @2penry2 Před 5 měsíci

      Take a look at the Web Push protocol and Service workers

  • @Edgars82
    @Edgars82 Před 5 měsíci

    This works only if your app is open.

  • @wendelsabayo9233
    @wendelsabayo9233 Před 5 měsíci

    Sir what's your vs theme ?

    • @WebDevCody
      @WebDevCody  Před 5 měsíci +1

      Bearded theme stained blue

    • @wendelsabayo9233
      @wendelsabayo9233 Před 5 měsíci

      @@WebDevCody Thank you Sir, I'm currently 2nd year college learning about programming thank you

  • @dr.lazysloth3415
    @dr.lazysloth3415 Před 5 měsíci

    Great video