Discourse の UI を Flarum のようにするのはどれくらい難しいでしょうか?

Scale of 1-10 how difficult would it be? Hopefully this question doesn’t peeve anyone but Im torn between the two. Flarum has a really clean interface:

  1. Topic list is centered with no lines in between, yet its still easy to read.
  2. Search bar is all in the same sticky header and not a ‘nook’
  3. Category markers look better, not just a 4x4 square.

Hmm… thats about it I think… Does this make sense? Sorry if this is posted to the wrong section.

Sidenote info: Im currently testing out both software even though having a hard time putting discourse on the same server vs my other 1 click install server. At least I have this working because for some reason I get a blank page when finalizing the flarum install. Really if Discourse had the same Flarum UI and features discourse currently has it be a much easier pick :smiley:

「いいね!」 6
「いいね!」 10

The answer is that it would be easy.

Discourse has a Theming system (see themes tag) that makes the kind of changes you’re talking about just a matter of adding the right CSS rules.

You can add CSS either directly in the “Site Customisations” Admin Panel UI, or on your local machine in your editor of choice via the CLI, with the ability to preview changes instantly on your site.

If you’re not a coder, you can hire one in the marketplace.

As has already been mentioned, you can use my header search theme component for the header search part of your list.

「いいね!」 16

I like the Flarum homepage as shown in the second screenshot! Not sure how doable that would be with CSS given that the categories in Discourse are a dropdown. But I like the idea of having the categories as permanent sidebar on the left hand side (while browsing topics).

「いいね!」 8

It’s a nice looking design, but only when you are at the top of the page. Then the color banner disappears and you are left with just the white main header.
If you want to have a color header, then the topic banner won’t look as sexy. (would look like having two headers).
Also, the categories bullet list in Flarum doesn’t show descriptions. Did you try Material Design Stock Theme for Discourse?

「いいね!」 2

It could be done with a theme component, though it would require some javascript.

「いいね!」 2

I just remembered there’s some prior art on this by @bts here:

Once there’s a published theme available for this it’d be great if the two of you could compare notes and ideally end up with a single codebase.

「いいね!」 9

@erlend_sh さん、素晴らしい指摘ありがとうございます!このトピックはまだ見ていませんでした。はい、昨年まさにこれについて時間を費やし、Flarum 風のヘッダーに近いものを手に入れようと試みました。これが 私たちのサイト での外観です:



そして、私たちが考案した HTML / CSS の核心部分は以下の通りです。

CSS:
(これはすべて「common」内にあります。これ以外に、デスクトップとモバイル向けのいくつかの小さなマージン/パディングの調整もありますが、以下には含めていません。)

/* GENERAL */

body {
    overflow-x: hidden;
}

.custom-cat-header {
	display: block;
	margin-left: -9999px!important;
	padding-left: 9999px!important;
	margin-right: -9999px!important;
	padding-right: 9999px!important;
	text-align: center;
	margin-top: -18px;
}

.custom-cat-header p {
    color: #dddddd;
}

.custom-cat-header h1 {
    display: inline-block;
    margin-top: 20px;
    color: #dddddd;
    background-color: #222222;
    border-radius: 5px;
    width: inherit;
}

/* ALL CATEGORIES */
.custom-cat-header-all-categories {display: none;}
body.navigation-categories .custom-cat-header-all-categories, body.navigation-topics .custom-cat-header-all-categories {
    display: block; 
    background-color: #b1880b;
}
.custom-cat-header-all-categories h1 {color: #d4a411;}

/* PLAYING TECHNIQUE */
.custom-cat-header-playing-technique {display: none;}
body.category-playing-technique .custom-cat-header-playing-technique {
    display: block; 
    background-color: #9c2116;
}
.custom-cat-header-playing-technique h1 {color: #d62e1f;}
body.category-playing-technique .custom-cat-header-all-categories {display: none;}

/* repeat for all other categories! */

HTML(「After Header」セクション内):

<!-- ALL CATEGORIES -->
<div class="custom-cat-header custom-cat-header-all-categories">
    <a href="https://forum.troygrady.com/"><h1>All Categories</h1></a>
    <p>Welcome to the Cracking the Code Forum!</p>
</div>

<!-- PLAYING TECHNIQUE -->
<div class="custom-cat-header custom-cat-header-playing-technique">
    <a href="https://forum.troygrady.com/c/playing-technique"><h1>Playing Technique</h1></a>
    <p>Pickslanting, chunking, fretting, motion mechanics — ask your technical questions here.</p>
</div>

<!-- repeat for all other categories! -->

これは非常に視覚的に洗練されていますが、同時に多くの反復的な手動編集を伴う、非常にカスタム/ハック的なアプローチでもあります。私たちの約 10 個のカテゴリーにとっては簡単ですが、より高い柔軟性を求めるなら、以下のような単純なプラグインとして実装するのが面白いかもしれません。

  • カテゴリーの説明を自動的に取得して挿入する
  • 色の計算を自動的に処理する( ours はカテゴリーの色と似ていますが、より良いコントラスト/可読性のために、手動でヘッダーの背景色を少し暗くし、h1 の「ピル」テキストの色を少し明るくしました)。

プラグイン作成の経験はありません。しかし、現時点では、@lll さんと私が考案したものを組み合わせたテーマコンポーネントが次の良いステップのように思えます!

「いいね!」 16

Hey @lll I didnt see your reply before, and I didn’t test yours out before seeing bts’s version but I like that you did Javascript, leads to more connection when editing/change styles. It would be awesome if this was a theme component, idk how to do that yet but here’s what I did with bts’ code:

<!-- After Header section -->

<!-- PLAYING TECHNIQUE -->
<div class="custom-cat-header custom-cat-header-nites-cinema">
    <a href="https://forum.troygrady.com/c/playing-technique"><h1>Playing Technique</h1></a>
    <p>Pickslanting, chunking, fretting, motion mechanics — ask your technical questions here.</p>
    <img src="https://d11a6trkgmumsb.cloudfront.net/original/3X/c/b/cb4bec8901221d4a646e45e1fa03db3a65e17f59.png">
</div>

I added that img src things as a random idea I had after I was done with doing the below edit. Obviously you gotta make another style rule to make sure the img/icon fits in the header (I did it via inspect elements), the main thing I was going for:

/* In common CSS */

/* PLAYING TECHNIQUE */
.custom-cat-header-nites-cinema {display: none;}
body.category-nites-cinema  .custom-cat-header-nites-cinema {
    display: block; 
    background: url('http://wallpaperscraft.com/image/starry_sky_tree_milky_way_radiance_120245_602x339.jpg') 0px -300px fixed no-repeat;}
.custom-cat-header-playing-technique h1 {color: #d62e1f;}
body.category-playing-technique .custom-cat-header-all-categories {display: none;}

/* repeat for all other categories! */

This is what I did on my old forum version of bbpress which was a edit of a clone to make it look like flarum, Reference: https://github.com/Sceko/bbFlarum

but I added in background image and fixed position to make it look cool :sunglasses:

The result:

What can be done with a theme component if you add in my idea:

  1. javascript to pull in icon banner (if people like that) from category image or wherever
  2. javascript pulling in background img sources vs manually entering
  3. A commentedout CSS section for people who wanna do my edit, explaining what it does.

Thoughts? Again, thanks for the input both of you, and everyone in this topic

「いいね!」 7

I am definitely interested in implementing this once it gets sorted. Thumbs up, guys.

「いいね!」 4

So theres gonna be a bit of redundancy if you choose to have category image and description turned on, unless you wanna have different stuff in the header or just a background. Just gonna have to decide and finagle with the theme because I dont think category image and description is a themeable thing, its a build it setting for discourse.

Still awesome to have these options. All im gonna have is 2 main themes for my forums. Sometimes i get in an indecisive/perfectionist loop

「いいね!」 3

Yea the example you posted and the one I edited, it shows up on 2 of those locations (for category banner)

Off the top of your head is there a way to just show it on one of those pages (ie. Only on topic pages?[ The actual posts inside the category] ) vss CSS? If not do you think JavaScript could do it?

Well my edit I was gonna post is this: (For disabling the category description and logo only in the category page and nowhere else)

.category-heading {
clear: both;
display: none;
}

Then @awesomerobot comes along and totally 1ups me,lol. Yea dude that looks way better than the manual edits I was gonna do :open_mouth:

「いいね!」 1

I put together a rough theme component for this so you don’t have to create a bunch of redundant markup to show/hide… This will pull the appropriate category name, description, and background/text colors when you’re on a category list page.

My JS is hacked up from a few different posts on Meta, so definitely please improve it if you can.

Put this in common/header

<script type="text/discourse-plugin" version="0.8">
    const container = Discourse.__container__;    
    const { h } = require('virtual-dom');
   
    api.createWidget('category-header-widget', {
        tagName: 'span', 
        html(attrs, state) {
        
        const path = window.location.pathname;
        let category;
          
        const controller = container.lookup('controller:navigation/category');
        category = controller.get("category");
        
        if(/^\/c\//.test(path)) {
            $("body").addClass("category-header");            
            return h('div.category-title-header', {
                "attributes" : {
                    "style" : "background-color: #" + category.color + "; color: #" + category.text_color + ";"
                }

            }, h('div.category-title-contents', [
                    h('h1', category.name),   
                    h('p', category.description_text)          
                ])
            );
            } else {
                $("body").removeClass("category-header");
            }   
        }      
    }),

    api.decorateWidget('category-header-widget:after', helper => {
        helper.widget.appEvents.on('page:changed', () => {
            helper.widget.scheduleRerender();
        });
    });

</script> 
  
<script type='text/x-handlebars' data-template-name='/connectors/below-site-header/category-header-widget'>
    {{mount-widget widget="category-header-widget"}}
</script>

This is common/CSS

.category-title-header {
  padding-top: 60px;
  display: flex;
  text-align: center;
  width: 100%;
  justify-content: center;
  .category-title-contents {
    max-width: 500px;
    padding: 40px 0;
  }
}
.category-header {
 #main-outlet {
     padding-top: 20px;
 }
}

You can also target specific category headers with additional custom CSS by using this structure:

body.category-example {
    .category-title-header {
        background: url(example.jpg);
    }
}

With some time this could definitely be improved to support tags & topic titles!

Update: Made some refinements and put this in a repo as a theme component

「いいね!」 29

This already works great @awesomerobot!
Could you please add an “All Categories” banner as well?

「いいね!」 4

Nice work! Anyone having this live on their Discourse? I would like to check it out how looks like…

「いいね!」 3

I add this in my forum and it’s perfect! A little thing is that it takes only the first lines of the description of the categories and don’t show links.

This is my text with links :

We only see the first two lines (and without links)

「いいね!」 2

Flarum の他の魅力的な側面について、もっとここで議論があればいいのにと思います。Flarum はついに 1.0 に到達しました。私は依然として Discourse の方がほとんどの点で優れていると感じていますが、Flarum のデザイン/UI にも好きな部分があります。もし他の人々も Flarum 風の美学を懐かしんでいるなら、ぜひここで声をかけてほしいです。そうすれば、ついにテーマを構築できるかもしれません(残念ながら私にはそのスキルはありませんが、もし関心があるなら、金銭的にグループの取り組みに貢献できるかもしれません)。

現時点では、ヘッダー以外の部分に対処するために、サイドバーは主に以下の方法で再現できると考えています:

ただし、タグのサポートはありません。あるいはこちらもあります:

問題は、どちらも更新・メンテナンスまたはリファクタリングが必要に見えることです。

私の知る限り、Discourse には完全に欠けている機能やデザインのアプローチとして、より明確なテキストボックス型の「返信」エリアがあります。これは「返信」ボタンの良い代替案だと思います:


これは単に「簡単」または「摩擦が少ない」ように見える返信アプローチ以上のものです。アバター画像が最初から追加されているという点は、興味深いディテールであり、個人的にはそれが相互作用を促すと考えています。なぜなら、それは微妙に「すでに参加している」という感覚を呼び起こすからです。

実際、これはそれ自体で機能リクエストに値するほど優れたアイデアだと考えています。

「いいね!」 5

また、こちらもお検討ください:Layouts Plugin

「いいね!」 3

おっと、確かにそうですね!できるだけ早く試してみます。

「いいね!」 1

その通りです。Discourse の最も初期の段階から、返信を「あらかじめ入力された入力欄」ではなく、ユーザーが明示的にトリガーする別個のアクションとして設計したのは、意図的なデザイン上の選択です。私たちは、即座に返信することを促すのではなく、まず「読む」ことを奨励しています(「インターネット上で誰かが間違っている」という理由で即座に反応するのではなく)。現在のインターネット上の多くの問題は、多くの人々が十分に考えずに即座に反応することに起因していると考えられます。

チャット機能の導入は、「最初に浮かんだ感情で即座に反応しなければならない」という衝動からのプレッシャーを軽減し、それをより適切な形で方向付ける役割も果たすはずです。

サイドバーが欲しい場合は、それは Teams の機能です。

「いいね!」 8