Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE: Categories, breadcrumbs, top topics, ctas, banners, navigation #17

Merged
merged 43 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
04374ef
Initial commit by `discourse_theme` CLI
carsick May 29, 2024
c9d8594
init
carsick May 29, 2024
ef14f9b
init
carsick May 30, 2024
fffea4f
community guidelines
carsick Jun 4, 2024
6211e0c
init
carsick Jun 5, 2024
20cbd91
Merge remote-tracking branch 'origin/staging' into org-main
carsick Jun 5, 2024
5a0cf7c
lint
carsick Jun 5, 2024
006fb9b
lint
carsick Jun 5, 2024
27621be
Merge branch 'staging' into org-staging
carsick Jun 5, 2024
dc4c46d
refactor
carsick Jun 5, 2024
449abb0
refactor
carsick Jun 5, 2024
d994e02
license
carsick Jun 5, 2024
72ec014
lint
carsick Jun 5, 2024
1be83da
lint
carsick Jun 5, 2024
fb0f4f5
lint
carsick Jun 5, 2024
dfaf934
lint
carsick Jun 5, 2024
882cd94
lint
carsick Jun 5, 2024
73e811f
blocks
carsick Jun 10, 2024
acdbbe1
settings
carsick Jun 11, 2024
173a6d9
Merge branch 'org-staging' into org/main
carsick Jun 11, 2024
4139f3c
lint
carsick Jun 11, 2024
c7a5d87
Merge branch 'main' into banner-block
carsick Jun 12, 2024
05248a0
banner other css
carsick Jun 12, 2024
e6a003b
hide banner
carsick Jun 13, 2024
0bc029d
top contributors
carsick Jun 20, 2024
374a9d6
Merge remote-tracking branch 'org/main' into banner-block
carsick Jun 20, 2024
ff7d7ce
categories, navigations, components, settings, subcategories
carsick Jun 24, 2024
90469e7
lint
carsick Jun 24, 2024
a60588b
lint
carsick Jun 24, 2024
fc6c79c
lint
carsick Jun 24, 2024
c1d0883
lint
carsick Jun 24, 2024
f2d5270
lint
carsick Jun 24, 2024
9d61105
lint
carsick Jun 24, 2024
40d07fc
lint
carsick Jun 24, 2024
beb6f7b
lint
carsick Jun 24, 2024
414762c
{{setting}} to %{setting}
carsick Jun 24, 2024
027c2d3
i18n
carsick Jun 24, 2024
218bf9c
no mobile
carsick Jun 24, 2024
780aa23
block updates
carsick Jul 1, 2024
aaf03a9
badge
carsick Jul 1, 2024
81cc721
Merge branch 'main' into banner-block
carsick Jul 1, 2024
6fcdc8e
lint
carsick Jul 1, 2024
a654f9f
lint
carsick Jul 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions about.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@
"minimum_discourse_version": null,
"maximum_discourse_version": null,
"assets": {},
"authors": "Carson",
"about_url": "TODO: Put your theme's public repo or Meta topic URL here",
"license_url": "TODO: Put your theme's LICENSE URL here",
"learn_more": "TODO",
"theme_version": "0.0.1",
"minimum_discourse_version": null,
"maximum_discourse_version": null,
"assets": {},
"modifiers": {
"serialize_topic_excerpts": "true"
},
Expand Down
1 change: 0 additions & 1 deletion javascripts/discourse/api-initializers/central.gjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// import { inject as service } from "@ember/service";
import { apiInitializer } from "discourse/lib/api";

export default apiInitializer("1.0", () => {
Expand Down
93 changes: 59 additions & 34 deletions javascripts/discourse/api-initializers/icons.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default apiInitializer("1.0", (api) => {
<li class="c-user">
<DMenu
@placement="bottom-end"
{{!-- @modalForMobile={{true}} --}}
@modalForMobile={{true}}
@identifier="c-user"
>
<:trigger>
Expand All @@ -38,42 +38,64 @@ export default apiInitializer("1.0", (api) => {
<span>{{currentUser.username}}</span>
</span>
<span class="c-user-menu__profile-cta">
View your profile
{{i18n (themePrefix "user.view_your_profile")}}
</span>
</div>
</LinkTo>
<ul class="c-user-menu__links">
<li data-name="messages">
<LinkTo @route="userPrivateMessages" @model={{currentUser}}>
<li>
<LinkTo
data-name="messages"
@route="userPrivateMessages"
@model={{currentUser}}
>
<span>
{{i18n "js.user.private_messages"}}
</span>
</LinkTo>
</li>
<li data-name="drafts">
<LinkTo @route="userActivity.drafts" @model={{currentUser}}>

<li>
<LinkTo
@route="userActivity.bookmarks"
@model={{this.currentUser}}
data-name="bookmarks"
>
<span>
{{i18n "js.drafts.label"}}
{{i18n "js.user.bookmarks"}}
</span>
</LinkTo>
</li>
<li data-name="invites">
<LinkTo @route="userInvited" @model={{currentUser}}>

<li>
<LinkTo
data-name="invites"
@route="userInvited"
@model={{currentUser}}
>
<span>
{{i18n "js.user.invited.title"}}
</span>
</LinkTo>
</li>

<li data-name="preferences">
<LinkTo @route="preferences" @model={{currentUser}}>
<li>
<LinkTo
data-name="preferences"
@route="preferences"
@model={{currentUser}}
>
<span>
{{i18n "user.preferences"}}
{{i18n "user.preferences.title"}}
</span>
</LinkTo>
</li>
<li data-name="logout">
<a role="button" onclick={{routeAction "logout"}}>
<li>
<a
data-name="logout"
role="button"
onclick={{routeAction "logout"}}
>
<span>
{{i18n "user.log_out"}}
</span>
Expand All @@ -82,8 +104,8 @@ export default apiInitializer("1.0", (api) => {
</ul>
{{#if (or currentUser.moderator currentUser.admin)}}
<ul class="c-user-menu__links">
<li data-name="flagged">
<LinkTo @route="review.index">
<li>
<LinkTo data-name="flagged" @route="review.index">
<span>Flagged
{{#unless (eq currentUser.reviewable_count 0)}}
({{currentUser.reviewable_count}})
Expand All @@ -92,22 +114,16 @@ export default apiInitializer("1.0", (api) => {
</LinkTo>
</li>

<li data-name="groups">
<LinkTo @route="groups.index">
<li>
<LinkTo data-name="groups" @route="groups.index">
<span>
{{i18n "js.groups.index.title"}}
</span>
</LinkTo>
</li>
<li data-name="tags">
<LinkTo @route="tags.index">
<span>
{{i18n "js.tagging.tags"}}
</span>
</LinkTo>
</li>
<li data-name="admin">
<LinkTo @route="admin.dashboard.general">

<li>
<LinkTo data-name="admin" @route="admin.dashboard.general">
<span>{{i18n "js.admin_title"}}</span>
</LinkTo>
</li>
Expand Down Expand Up @@ -140,7 +156,7 @@ export default apiInitializer("1.0", (api) => {
<li class="c-create">
<DMenu
@placement="bottom-end"
@modalForMobile={{true}}
{{!-- @modalForMobile={{true}} --}}
@identifier="c-create"
>
<:trigger>
Expand All @@ -149,12 +165,21 @@ export default apiInitializer("1.0", (api) => {
<:content as |args|>
{{! template-lint-disable no-invalid-interactive }}
<ul class="c-create__menu" {{on "click" args.close}}>
<li><LinkTo @route="new-topic">New topic</LinkTo></li>
<li><LinkTo @route="new-message">New message</LinkTo></li>
<li><LinkTo
@route="userActivity.drafts"
@model={{currentUser}}
>Drafts</LinkTo></li>
<li>
<LinkTo @route="new-topic">
<span>{{i18n "js.topic.create"}}</span>
</LinkTo>
</li>
<li>
<LinkTo @route="new-message">
<span>{{i18n "js.user.new_private_message"}}</span>
</LinkTo>
</li>
<li>
<LinkTo @route="userActivity.drafts" @model={{currentUser}}>
<span>{{i18n "js.drafts.label"}}</span>
</LinkTo>
</li>
</ul>
</:content>
</DMenu>
Expand Down
45 changes: 45 additions & 0 deletions javascripts/discourse/components/blocks/banner.gjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { concat } from "@ember/helper";
// import { eq, or } from "truth-helpers";

// import UserLink from "discourse/components/user-link";
// import avatar from "discourse/helpers/avatar";
// import { ajax } from "discourse/lib/ajax";
// import i18n from "discourse-common/helpers/i18n";

export default class BlockBanner extends Component {
@tracked title = this.args?.title;
@tracked description = this.args?.description;
@tracked ctas = this.args?.ctas;
@tracked image = this.args?.image;

constructor() {
super(...arguments);
}

<template>
<div class="block block-banner">
{{#if this.title}}
<h1>
{{this.title}}
</h1>
{{/if}}
{{#if this.description}}
<span class="block-banner__blurb">
{{this.description}}
</span>
{{/if}}
{{!log this.ctas}}
{{#if this.ctas}}
<div class="block-banner__ctas">
{{#each this.ctas as |cta|}}
<a href={{cta.url}} class={{concat "button--" cta.style}}>
<span>{{cta.label}}</span>
</a>
{{/each}}
</div>
{{/if}}
</div>
</template>
}
38 changes: 38 additions & 0 deletions javascripts/discourse/components/blocks/cta.gjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
// eslint-disable-next-line no-unused-vars
import { concat } from "@ember/helper";
// eslint-disable-next-line no-unused-vars
import { inject as service } from "@ember/service";
// eslint-disable-next-line no-unused-vars
import { htmlSafe } from "@ember/template";
// import { eq, or } from "truth-helpers";
// import avatar from "discourse/helpers/avatar";
import concatClass from "discourse/helpers/concat-class";
// import { ajax } from "discourse/lib/ajax";

export default class BlockCta extends Component {
@tracked title = this.args?.title;
@tracked desc = this.args?.description;
@tracked cta = this.args?.cta;
@tracked url = this.args?.url;

constructor() {
super(...arguments);
}

get size() {
if (this.args.size) {
return `block--${this.args.size}`;
}
return;
}

<template>
<div class={{concatClass "block block-cta" this.size}}>
<h4>{{this.title}}</h4>
<p>{{this.desc}}</p>
<a role="button" href={{this.url}}><span>{{this.cta}}</span></a>
</div>
</template>
}
49 changes: 22 additions & 27 deletions javascripts/discourse/components/blocks/profile.gjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { concat } from "@ember/helper";
import { LinkTo } from "@ember/routing";
import { inject as service } from "@ember/service";
import { htmlSafe } from "@ember/template";
// import { eq, or } from "truth-helpers";
import avatar from "discourse/helpers/avatar";
import concatClass from "discourse/helpers/concat-class";
import { ajax } from "discourse/lib/ajax";
import i18n from "discourse-common/helpers/i18n";

export default class BlockProfile extends Component {
@service currentUser;
Expand All @@ -28,13 +30,6 @@ export default class BlockProfile extends Component {
}
}

get hello() {
const greetings = ["Hello", "Welcome", "Greetings", "Salutations"];

const index = Math.floor(Math.random() * greetings.length);
return greetings[index];
}

get size() {
if (this.args.size) {
return `block--${this.args.size}`;
Expand Down Expand Up @@ -65,30 +60,26 @@ export default class BlockProfile extends Component {
</div>
<div class="block-profile__info">

<div class="block-profile__name-wrapper">
<span class="block-profile__name">
{{i18n
(themePrefix "blocks.profile.hello")
name=(if
this.currentUser.name
this.currentUser.name
this.currentUser.username
)
}}
</span>
</div>

{{#if this.currentUser.name}}
<div class="block-profile__name-wrapper">
<span class="block-profile__hello">
{{this.hello}}
</span>
<span class="block-profile__name">
{{this.currentUser.name}}
</span>
</div>
<a
class="block-profile__username"
href={{concat "/u/" this.currentUser.username}}
>
{{this.currentUser.username}}
</a>
{{else}}
<div class="block-profile__name-wrapper">
<span class="block-profile__hello">
{{this.hello}}
</span>
<span class="block-profile__name">
{{this.currentUser.username}}
</span>
</div>
{{/if}}

<span class="block-profile__bio">
Expand All @@ -103,9 +94,13 @@ export default class BlockProfile extends Component {
</span>
{{/if}}

<div class="block-profile__edit">
Edit
</div>
<LinkTo
@route="preferences.profile"
@model={{this.currentUser}}
class="block-profile__edit"
>
<span>{{i18n "js.edit"}}</span>
</LinkTo>
</div>
{{else}}
<div class="block block-profile">
Expand Down
Loading