Mobile Tab Component

License Latest Stable Version Total Downloads GitHub Sponsors

A Flarum extension. Adds a bottom tab on mobile.

Imgur

Installation

Install with composer:

composer require acpl/mobile-tab

Updating

composer update acpl/mobile-tab
php flarum cache:clear

Extending

You can add, modify, and delete items in the mobile tab using your own extension.
Read: https://docs.flarum.org/extend/extending-extensions/

  1. Install acpl/mobile-tab as your extension's composer dependency or add it as an optional dependency in your composer.json.
  2. Add acpl-mobile-tab to your extension's webpack.config.js to ensure proper bundling:
    const config = require("flarum-webpack-config");
    
    module.exports = config({
      useExtensions: ["acpl-mobile-tab"],
    });
  3. You can now import and use mobile tab components in your extension. Here are some examples of how to modify the mobile tab:
    import { components } from "@acpl-mobile-tab";
    import { extend } from "flarum/common/extend";
    
    const { MobileTab, MobileTabItem } = components;
    
    export default () => {
      // Extend the items method of MobileTab prototype
      extend(MobileTab.prototype, "items", (items) => {
        // Add new item
        items.add(
          "following",
          <MobileTabItem
            href={app.route("following")}
            icon="fas fa-star"
            label={app.translator.trans("my-ext.forum.my-item")}
          />,
          90,
        );
    
        // Add new item using custom HTML
        items.add("my-item", <div>...This is my custom item</div>, 70);
    
        // Remove item
        items.remove("home");
      });
    };

If you are using TypeScript, add the following path to your tsconfig.json to enable type hints for the mobile tab components in your code editor:

{
  "extends": "flarum-tsconfig",
  "compilerOptions": {
    "paths": {
      "@acpl-mobile-tab": [
        "./vendor/acpl/mobile-tab/js/dist-typings/index.d.ts"
      ]
    }
  }
}

Links

    • [deleted]

    rafaucau Could you provide a bit more clarity as to where exactly the code you've included to extend the mobile toolbar needs to be added ?

    Thanks

      • [deleted]

      robinodds Yes, it does seem odd that new post is missing. For the remainder, there's always CSS...

        [deleted] Yes, it does seem odd that new post is missing.

        I didn't add this because it is already in the top menu of Flarum.
        This is a extension created for my forum, but made public at the request of users. So I'll definitely look into fixing issues, but I'm not promising new features.

        @rafaucau touching the tag menu in the mobile UI breaks the page. It happens only after tags is pressed. The page has to be manually refresh for it to work and after the refresh, touching it again breaks it. No error log in the server.

        Check it out at https://www.kobocity.com

          • [deleted]

          Ffuser1 Are you using the blog extension by any chance ?

            • [deleted]

            Ffuser1 Are you hiding the any of the "blog" tags in the blog extension settings ? For example, in the blog settings, is this enabled ?

            Don't show on discussion list
            Hide blog posts from the discussions list.

            If it is, disable it and try again.

              • [deleted]

              Ffuser1 I have the same issue. I want to hide the blog tag, but doing so breaks other extensions - including the "tag" extension in the same manner. I'm just going to target that specific tag with CSS and set it to display: none;

                [deleted] this is the settings I disabled and it worked.
                -hide tag in taglists
                It's under category subheading in blog setting's page.
                Are you using category extension?

                  • [deleted]

                  Ffuser1 not currently, no, but planning to do so