Skip to content

Commit c411b05

Browse files
authored
UX: Make bookmark icon more readable on mobile (discourse#36096)
On mobile the icon for bookmarked/unbookmarked posts is the same, and the only way to differentiate the state is the icon color; it may be hard to tell the difference. This fixes it by changing the icon when unbookmarked. This is related to [this post on Discourse meta](https://meta.discourse.org/t/change-bookmark-icon-for-non-bookmarked-posts-on-mobile-view/388854). Result on desktop: <img width="126" height="38" alt="image" src="https://github.com/user-attachments/assets/f9eb9d70-6378-441d-9072-22815b36290f" /> <img width="161" height="38" alt="image" src="https://github.com/user-attachments/assets/aea963dc-482f-4a40-b432-3dd58e9c6bfc" /> Result on mobile: <img width="45" height="39" alt="image" src="https://github.com/user-attachments/assets/e5018ed9-b214-45e3-9e21-310b5a7b72be" /> <img width="45" height="39" alt="image" src="https://github.com/user-attachments/assets/b239566a-5971-47c0-9221-6c2496f46cbd" />
1 parent 3311824 commit c411b05

File tree

5 files changed

+16
-4
lines changed

5 files changed

+16
-4
lines changed

frontend/discourse/app/components/bookmark-icon.gjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import Component from "@glimmer/component";
22
import icon from "discourse/helpers/d-icon";
33
import {
44
NO_REMINDER_ICON,
5+
NOT_BOOKMARKED,
56
WITH_REMINDER_ICON,
67
} from "discourse/models/bookmark";
78
import { i18n } from "discourse-i18n";
@@ -10,9 +11,11 @@ export default class BookmarkIcon extends Component {
1011
get icon() {
1112
if (this.args.bookmark?.get("reminder_at")) {
1213
return WITH_REMINDER_ICON;
14+
} else if (this.args.bookmark) {
15+
return NO_REMINDER_ICON;
1316
}
1417

15-
return NO_REMINDER_ICON;
18+
return NOT_BOOKMARKED;
1619
}
1720

1821
get cssClasses() {

frontend/discourse/app/components/bookmark-menu.gjs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ import {
1313
TIME_SHORTCUT_TYPES,
1414
timeShortcuts,
1515
} from "discourse/lib/time-shortcut";
16+
import {
17+
NO_REMINDER_ICON,
18+
NOT_BOOKMARKED,
19+
WITH_REMINDER_ICON,
20+
} from "discourse/models/bookmark";
1621
import { i18n } from "discourse-i18n";
1722

1823
export default class BookmarkMenu extends Component {
@@ -96,9 +101,11 @@ export default class BookmarkMenu extends Component {
96101

97102
get buttonIcon() {
98103
if (this.existingBookmark?.reminderAt) {
99-
return "discourse-bookmark-clock";
104+
return WITH_REMINDER_ICON;
105+
} else if (this.existingBookmark) {
106+
return NO_REMINDER_ICON;
100107
} else {
101-
return "bookmark";
108+
return NOT_BOOKMARKED;
102109
}
103110
}
104111

frontend/discourse/app/models/bookmark.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export const AUTO_DELETE_PREFERENCES = {
2323
};
2424

2525
export const NO_REMINDER_ICON = "bookmark";
26+
export const NOT_BOOKMARKED = "far-bookmark";
2627
export const WITH_REMINDER_ICON = "discourse-bookmark-clock";
2728

2829
export default class Bookmark extends RestModel {

frontend/discourse/tests/integration/components/bookmark-icon-test.gjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ module("Integration | Component | bookmark-icon", function (hooks) {
5555
test("no bookmark", async function (assert) {
5656
await render(<template><BookmarkIcon /></template>);
5757

58-
assert.dom(".d-icon-bookmark.bookmark-icon").exists();
58+
assert.dom(".d-icon-far-bookmark.bookmark-icon").exists();
5959
assert
6060
.dom(".svg-icon-title")
6161
.hasAttribute("title", i18n("bookmarks.create"));

lib/svg_sprite.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ module SvgSprite
130130
fab-windows
131131
far-bell
132132
far-bell-slash
133+
far-bookmark
133134
far-calendar-plus
134135
far-chart-bar
135136
far-circle

0 commit comments

Comments
 (0)