Author SHA1 Message Date
Jordan Vidrine 7cc39605f5 linting 2025-01-14 19:02:34 -06:00
Jordan Vidrine fed8205a64 DEV: Add fake category data 2025-01-14 15:57:23 -06:00
Jordan Vidrine d669a39a00 UX: Make card clickable link 2025-01-14 15:55:14 -06:00
5 changed files with 18 additions and 24 deletions
@@ -3,7 +3,19 @@
# Topics visited grouped by category
module DiscourseRewind
class Rewind::Action::FavoriteCategories < Rewind::Action::BaseReport
FakeData = {
data: [
{ category_id: 1, name: "cats" },
{ category_id: 2, name: "dogs" },
{ category_id: 3, name: "countries" },
{ category_id: 4, name: "management" },
{ category_id: 5, name: "things" },
],
identifier: "favorite-categories",
}
def call
return FakeData if Rails.env.development?
favorite_categories =
TopicViewItem
.joins(:topic)
@@ -7,7 +7,7 @@ module DiscourseRewind
{ word: "what", score: 100 },
{ word: "have", score: 90 },
{ word: "you", score: 80 },
{ word: "overachieved", score: 70 },
{ word: "achieved", score: 70 },
{ word: "this", score: 60 },
{ word: "week", score: 50 },
],
@@ -10,12 +10,12 @@ const FavoriteCategories = <template>
}}</h2>
<div class="rewind-report-container">
{{#each @report.data as |data|}}
<div class="rewind-card">
<a
<a href={{concat "/c/-/" data.category_id}} class="rewind-card">
<p
class="favorite-categories__category"
href={{concat "/c/-/" data.category_id}}
>{{data.name}}</a>
</div>
>{{data.name}}</p>
</a>
{{/each}}
</div>
</div>
@@ -3,7 +3,6 @@ import { on } from "@ember/modifier";
import { action } from "@ember/object";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import { htmlSafe } from "@ember/template";
import concatClass from "discourse/helpers/concat-class";
import emoji from "discourse/helpers/emoji";
import discourseLater from "discourse-common/lib/later";
@@ -46,10 +45,6 @@ export default class WordCard extends Component {
};
}
get longWord() {
return this.args.word.length >= 7;
}
get cardStyle() {
return htmlSafe(`${this.randomStyle}; ${this.mysteryData.color};`);
}
@@ -77,10 +72,7 @@ export default class WordCard extends Component {
<div
{{on "click" this.handleClick}}
{{on "mouseleave" this.handleLeave}}
class={{concatClass
"rewind-card__wrapper"
(if this.longWord "-long-word")
}}
class="rewind-card__wrapper"
style={{this.cardStyle}}
{{didInsert this.registerCardContainer}}
role="button"
-10
View File
@@ -137,16 +137,6 @@
0 0 / 6px 6px,
var(--secondary-low);
}
&.-long-word .rewind-card__title {
font-size: var(--font-0);
}
&.-long-word .rewind-card {
padding: 2px;
}
.rewind-card__title {
overflow-wrap: anywhere;
hyphens: auto;
}
.rewind-card__image {
image-rendering: pixelated;
}