better indication and text for toggleable actions

This commit is contained in:
Henry Jameson 2025-01-15 02:27:32 +02:00
parent 692ee06477
commit eafa378eb9
6 changed files with 32 additions and 9 deletions

View file

@ -26,7 +26,8 @@ import {
faHistory faHistory
} from '@fortawesome/free-solid-svg-icons' } from '@fortawesome/free-solid-svg-icons'
import { import {
faStar as faStarRegular faStar as faStarRegular,
faBookmark as faBookmarkRegular
} from '@fortawesome/free-regular-svg-icons' } from '@fortawesome/free-regular-svg-icons'
library.add( library.add(
@ -46,6 +47,7 @@ library.add(
faSmileBeam, faSmileBeam,
faBookmark, faBookmark,
faBookmarkRegular,
faEyeSlash, faEyeSlash,
faThumbtack, faThumbtack,
faShareAlt, faShareAlt,

View file

@ -20,6 +20,18 @@
padding: 0.5em; padding: 0.5em;
} }
.separator {
width: 0.5em;
&::before {
content: "";
display: block;
width: 1px;
height: 1.5em;
background-color: var(--icon);
}
}
.action-button-inner { .action-button-inner {
display: grid; display: grid;
grid-gap: 1em; grid-gap: 1em;
@ -28,10 +40,6 @@
grid-auto-columns: max-content; grid-auto-columns: max-content;
align-items: center; align-items: center;
} }
.extra-button {
border-left: 1px solid var(--icon);
}
} }
.action-button { .action-button {

View file

@ -62,6 +62,11 @@
fixed-width fixed-width
/> />
</component> </component>
<span
v-if="!extra && button.name === 'bookmark'"
class="separator"
>
</span>
<Popover <Popover
trigger="hover" trigger="hover"
:placement="extra ? 'right' : 'top'" :placement="extra ? 'right' : 'top'"

View file

@ -23,7 +23,9 @@ export const BUTTONS = [{
// REPEAT // REPEAT
// ========= // =========
name: 'retweet', name: 'retweet',
label: 'tool_tip.repeat', label: ({ status }) => status.repeated
? 'tool_tip.unrepeat'
: 'tool_tip.repeat',
icon ({ status }) { icon ({ status }) {
if (PRIVATE_SCOPES.has(status.visibility)) { if (PRIVATE_SCOPES.has(status.visibility)) {
return 'lock' return 'lock'
@ -55,7 +57,9 @@ export const BUTTONS = [{
// FAVORITE // FAVORITE
// ========= // =========
name: 'favorite', name: 'favorite',
label: 'tool_tip.favorite', label: ({ status }) => status.favorited
? 'tool_tip.unfavorite'
: 'tool_tip.favorite',
icon: ({ status }) => status.favorited icon: ({ status }) => status.favorited
? ['fas', 'star'] ? ['fas', 'star']
: ['far', 'star'], : ['far', 'star'],
@ -122,7 +126,9 @@ export const BUTTONS = [{
// BOOKMARK // BOOKMARK
// ========= // =========
name: 'bookmark', name: 'bookmark',
icon: 'bookmark', icon: ({ status }) => status.bookmarked
? ['fas', 'bookmark']
: ['far', 'bookmark'],
toggleable: true, toggleable: true,
active: ({ status }) => status.bookmarked, active: ({ status }) => status.bookmarked,
label: ({ status }) => status.bookmarked label: ({ status }) => status.bookmarked

View file

@ -5,7 +5,7 @@ import ActionButtonContainer from './action_button_container.vue'
import Popover from 'src/components/popover/popover.vue' import Popover from 'src/components/popover/popover.vue'
import genRandomSeed from 'src/services/random_seed/random_seed.service.js' import genRandomSeed from 'src/services/random_seed/random_seed.service.js'
import { BUTTONS } from './buttons_definitions.vue' import { BUTTONS } from './buttons_definitions.js'
import { library } from '@fortawesome/fontawesome-svg-core' import { library } from '@fortawesome/fontawesome-svg-core'
import { import {

View file

@ -1414,9 +1414,11 @@
"media_upload": "Upload media", "media_upload": "Upload media",
"mentions": "Mentions", "mentions": "Mentions",
"repeat": "Repeat", "repeat": "Repeat",
"unrepeat": "Unrepeat",
"reply": "Reply", "reply": "Reply",
"add_reaction": "Add reaction", "add_reaction": "Add reaction",
"favorite": "Favorite", "favorite": "Favorite",
"unfavorite": "Unfavorite",
"add_reaction": "Add Reaction", "add_reaction": "Add Reaction",
"user_settings": "User Settings", "user_settings": "User Settings",
"accept_follow_request": "Accept follow request", "accept_follow_request": "Accept follow request",