clarkwinkelmann Дайте мне знать, если у вас есть идеи на ближайшие недели

Give rewards to users for certain actions on the forum. Example: write the first discussion

    Alkir I would love to work on something like that one day, but it requires a whole ecosystem. First we need to define what rewards can be. Then we need to implement these rewards (badges, emails, levels, groups, physical goods, ...?). Then we need to implement ways to unlock them. If everything is in a single extension, it would be incredibly massive and I wouldn't make it open-source (unless it's sponsored). If everything is separate extensions, we need to come together and define how these will interact with each others, including maybe a (core) extension to handle the base logic on which extension developers can build upon.

    clarkwinkelmann Let me know if you have ideas for the next weeks!

    I have an extension in mind that can be used together with custom CSS in multiple ways. The extension just adds classes to the <body> element like the existing no-touch for a variety of states like the login status, the chosen language, the selected tags for discussions, indicators for pages, user lists etc.

    In your video you wouldn't need to provide classes for everything, instead your approach could be used by others to build upon your work.

      clarkwinkelmann Let me know if you have ideas for the next weeks!

      I'm working on two extensions, one requires the other. I have my project set up with a workbench folder like you have in your video's. There are no resources available on the compat API yet and I can't seem to get it right. Maybe you could touch on it?

        nxta good idea, I'll see how I can introduce that.

        The "compat" API actually is only a feature meant to be used by Flarum core extension to export to the flarum namespace.

        What extensions can do is export objects from their index.js. Here's an example I worked on in the past:

        User directory exports the UserDirectoryPage object https://github.com/FriendsOfFlarum/user-directory/blob/master/js/src/forum/index.js#L9

        Mailing checks the user directory extension is enabled and gets the exported object from the extension object https://github.com/kilowhat/flarum-ext-mailing/blob/master/js/src/forum/addMailingLinks.js#L40

          Pollux I have an extension in mind that can be used together with custom CSS in multiple ways. The extension just adds classes to the <body> element like the existing no-touch for a variety of states like the login status, the chosen language, the selected tags for discussions, indicators for pages, user lists etc.

          For those who question the usefulness of an extension like that... with this extension one could:

          • provide links to pages only visible to guests or logged in users
          • style different parts of the forum in completely unique ways (e.g. according to tags)
          • change the appearance according to time and date (e.g. night view, christmas decoration)
          • provide localised FAQs (provide a link for every language and show only the one that applies based on the selected language)
          • give a custom visual indicator for locked discussions, very old discussions, newbie questions etc.

          The possibilities are endless.

          Pollux In your video you wouldn't need to provide classes for everything, instead your approach could be used by others to build upon your work.

          Regarding this part I'm not sure it's easy to build upon to add new classes. Pushing new classes to an element or body is very easy. It's writing the logic for each kind of class that's difficult. So even after watching my video, you would still be left with the most difficult part if you wanted to implement a new class for a new kind of thing 😬

          From the educational point of view, watching this extension being written would primarily teach the various properties of objects like tags and discussions I think. Which is also an interesting thing.

          I'll see what ideas I keep.

          I need to build a public review+comment (google like) extension for one of my projects, this will probably be this week's extension. I will incorporate some extensibility aspects into it (server side though).

          Join me live in two hours!

          We will create a "google-like" ratings extension that will be designed to integrate with other extensions.

          14 days later

          Join me live in 2 hours:

          We will be revisiting the carving extension to make it more flexible and more performant.

          I have created this page on my website to list the videos I made: https://clark-writes-code.winkelmann.dev/

          Right now the only additional info compared to YouTube is the Flarum version, but I will probably add a short list of topics on each video so you can better pick one.

            clarkwinkelmann thanks to the live viewers who joined! The replay is available above for everyone else.

            The Carving extension update created tonight has been released https://discuss.flarum.org/d/21828-pumpkin-carving-contest/9

            As always the code is available on GitHub https://github.com/clarkwinkelmann/flarum-ext-carving-contest

            Next stream will be the last of the year. Any suggestions for something festive (Christmas or New Year) is welcome!

            clarkwinkelmann

            How would I create a new component that extends the exported one? If that makes sense

            eg.
            class NewUserDirectoryPage extends UserDirectoryPage

            flarum.extensions is not available at this point

              nxta I would say it's probably a rare use case, as I've never felt the need to extend a javascript class that way.

              You could create your new class inside your initializer method, after having checked the extension is available in flarum.extensions. Classes can be defined inside of a function, they don't absolutely need to be defined in their own files.

              Rather than building my app separately from Flarum and then hooking it all up via API's, I've decided to build my app into Flarum as extensions. So I'm introducing a bunch of new components, something you probably don't have to do very often when you work on Flarum. My use case is similar to IndexPage extending Page. I introduced a Card and want to make a PlayerCard in another extension. Then I want another extension to be able to extend the PlayerCard prototype.

              I've decided to change approach though and make full use of ItemList and its powers. Everything I need is in the base component now and I no longer have to extend it.

              Thanks!

                nxta you might want to take a look at how fof/components was made https://github.com/FriendsOfFlarum/components

                I have not yet taken the time to look at it myself yet and I don't think it's well documented at this time. But basically it's meant to be used by other FoF extensions. David or another member of FoF might be able to explain how it works.

                • nxta replied to this.

                  clarkwinkelmann That's brilliant, I didn't realise you could do that to the JS with an Extender. Cheers

                  Hello everyone.

                  I have created a small survey to collect your feedback on this year's live streams. You can participate here https://docs.google.com/forms/d/e/1FAIpQLSe1a9kG8wesPRpOKXl4hRzKg-jcLOw_nCstwoAOnb00iE3qrw/viewform?usp=sf_link

                  Next stream will happen this weekend or next week. If you answer the survey quickly I might be able to pick one of the times that work for you 😃 But no hurry, I'll also promote the survey in the next stream.

                  If you think doing the stream on Christmas day is a good idea, let me know in the "other feedback" field of the survey. It would work for me, but I suspect many of you will have some other festive activities planned... Or maybe not 🎅

                  Next stream will take place on December 23 at 20:00 UTC, that's about 20 hours from now.

                  We will discuss some ways to "theme" a forum, which shares many concepts with extension writing.

                  If there are some designs you'd like to see me replicate (from another Flarum or from non-Flarum websites), please post links to example websites in the live chat (now or during the stream), and I'll have a try at them.

                  I hope you will be able to join me for this last stream of the year!

                  https://youtu.be/V6YT3GG22ic