Customisation of default profile tab, clean up settings (#156)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Co-authored-by: FloatingGhost <hannah@coffee-and-dreams.uk>
Reviewed-on: AkkomaGang/pleroma-fe#156
This commit is contained in:
floatingghost 2022-09-05 17:02:16 +00:00
parent c301daa276
commit ae1b6ad887
7 changed files with 54 additions and 47 deletions

View file

@ -55,8 +55,10 @@ const ExtraButtons = {
hideDeleteStatusConfirmDialog () { hideDeleteStatusConfirmDialog () {
this.showingDeleteDialog = false this.showingDeleteDialog = false
}, },
translateStatus () { translateStatus () {
if (this.noTranslationTargetSet) {
this.$store.dispatch('pushGlobalNotice', { messageKey: 'toast.no_translation_target_set', level: 'info' })
}
const translateTo = this.$store.getters.mergedConfig.translationLanguage || this.$store.state.instance.interfaceLanguage const translateTo = this.$store.getters.mergedConfig.translationLanguage || this.$store.state.instance.interfaceLanguage
this.$store.dispatch('translateStatus', { id: this.status.id, language: translateTo }) this.$store.dispatch('translateStatus', { id: this.status.id, language: translateTo })
.then(() => this.$emit('onSuccess')) .then(() => this.$emit('onSuccess'))
@ -120,6 +122,9 @@ const ExtraButtons = {
canTranslate () { canTranslate () {
return this.$store.state.instance.translationEnabled === true return this.$store.state.instance.translationEnabled === true
}, },
noTranslationTargetSet () {
return this.$store.getters.mergedConfig.translationLanguage === undefined
},
statusLink () { statusLink () {
if (this.status.is_local) { if (this.status.is_local) {
return `${this.$store.state.instance.server}${this.$router.resolve({ name: 'conversation', params: { id: this.status.id } }).href}` return `${this.$store.state.instance.server}${this.$router.resolve({ name: 'conversation', params: { id: this.status.id } }).href}`

View file

@ -126,6 +126,16 @@
fixed-width fixed-width
icon="globe" icon="globe"
/><span>{{ $t("status.translate") }}</span> /><span>{{ $t("status.translate") }}</span>
<template v-if="noTranslationTargetSet">
<span class="dropdown-item-icon__badge warning">
<FAIcon
fixed-width
icon="exclamation-triangle"
name="test"
/>
</span>
</template>
</button> </button>
</div> </div>
</template> </template>

View file

@ -43,6 +43,11 @@ const GeneralTab = {
value: mode, value: mode,
label: this.$t(`settings.third_column_mode_${mode}`) label: this.$t(`settings.third_column_mode_${mode}`)
})), })),
userProfileDefaultTabOptions: ['statuses', 'replies'].map(tab => ({
key: tab,
value: tab,
label: this.$t(`user_card.${tab}`)
})),
loopSilentAvailable: loopSilentAvailable:
// Firefox // Firefox
Object.getOwnPropertyDescriptor(HTMLVideoElement.prototype, 'mozHasAudio') || Object.getOwnPropertyDescriptor(HTMLVideoElement.prototype, 'mozHasAudio') ||

View file

@ -15,11 +15,6 @@
{{ $t('settings.hide_isp') }} {{ $t('settings.hide_isp') }}
</BooleanSetting> </BooleanSetting>
</li> </li>
<li>
<BooleanSetting path="sidebarRight">
{{ $t('settings.right_sidebar') }}
</BooleanSetting>
</li>
<li v-if="instanceWallpaperUsed"> <li v-if="instanceWallpaperUsed">
<BooleanSetting path="hideInstanceWallpaper"> <BooleanSetting path="hideInstanceWallpaper">
{{ $t('settings.hide_wallpaper') }} {{ $t('settings.hide_wallpaper') }}
@ -104,41 +99,7 @@
{{ $t('settings.virtual_scrolling') }} {{ $t('settings.virtual_scrolling') }}
</BooleanSetting> </BooleanSetting>
</li> </li>
<li>
<BooleanSetting path="disableStickyHeaders">
{{ $t('settings.disable_sticky_headers') }}
</BooleanSetting>
</li>
<li>
<BooleanSetting path="showScrollbars">
{{ $t('settings.show_scrollbars') }}
</BooleanSetting>
</li>
<li>
<ChoiceSetting
v-if="user"
id="thirdColumnMode"
path="thirdColumnMode"
:options="thirdColumnModeOptions"
>
{{ $t('settings.third_column_mode') }}
</ChoiceSetting>
</li>
<li>
<BooleanSetting path="minimalScopesMode">
{{ $t('settings.minimal_scopes_mode') }}
</BooleanSetting>
</li>
<li>
<BooleanSetting path="sensitiveByDefault">
{{ $t('settings.sensitive_by_default') }}
</BooleanSetting>
</li>
<li>
<BooleanSetting path="sensitiveIfSubject">
{{ $t('settings.sensitive_if_subject') }}
</BooleanSetting>
</li>
<li> <li>
<BooleanSetting path="renderMisskeyMarkdown"> <BooleanSetting path="renderMisskeyMarkdown">
{{ $t('settings.render_mfm') }} {{ $t('settings.render_mfm') }}
@ -156,6 +117,15 @@
</li> </li>
</ul> </ul>
</li> </li>
<li>
<ChoiceSetting
id="userProfileDefaultTab"
path="userProfileDefaultTab"
:options="userProfileDefaultTabOptions"
>
{{ $t('settings.user_profile_default_tab') }}
</ChoiceSetting>
</li>
<li> <li>
<ChoiceSetting <ChoiceSetting
v-if="user && (translationLanguages.length > 0)" v-if="user && (translationLanguages.length > 0)"
@ -487,12 +457,22 @@
/> />
</label> </label>
</li> </li>
<li>
<BooleanSetting path="minimalScopesMode">
{{ $t('settings.minimal_scopes_mode') }}
</BooleanSetting>
</li>
<li> <li>
<!-- <BooleanSetting path="serverSide_defaultNSFW"> --> <!-- <BooleanSetting path="serverSide_defaultNSFW"> -->
<BooleanSetting path="sensitiveByDefault"> <BooleanSetting path="sensitiveByDefault">
{{ $t('settings.sensitive_by_default') }} {{ $t('settings.sensitive_by_default') }}
</BooleanSetting> </BooleanSetting>
</li> </li>
<li>
<BooleanSetting path="sensitiveIfSubject">
{{ $t('settings.sensitive_if_subject') }}
</BooleanSetting>
</li>
<li> <li>
<BooleanSetting <BooleanSetting
path="scopeCopy" path="scopeCopy"

View file

@ -33,22 +33,21 @@ const FriendList = withLoadMore({
additionalPropNames: ['userId'] additionalPropNames: ['userId']
})(List) })(List)
const defaultTabKey = 'statuses'
const UserProfile = { const UserProfile = {
data () { data () {
return { return {
error: false, error: false,
userId: null, userId: null,
tab: defaultTabKey, tab: 'statuses',
footerRef: null, footerRef: null,
note: null, note: null,
noteLoading: false noteLoading: false
} }
}, },
created () { created () {
const defaultTabKey = this.defaultTabKey
const routeParams = this.$route.params const routeParams = this.$route.params
const hash = get(this.$route, 'hash', defaultTabKey).replace(/^#/, '') const hash = (get(this.$route, 'hash') || defaultTabKey).replace(/^#/, '')
if (hash !== '') this.tab = hash if (hash !== '') this.tab = hash
this.load(routeParams.name || routeParams.id) this.load(routeParams.name || routeParams.id)
}, },
@ -86,6 +85,9 @@ const UserProfile = {
}, },
currentUser () { currentUser () {
return this.$store.state.users.currentUser return this.$store.state.users.currentUser
},
defaultTabKey () {
return this.$store.getters.mergedConfig.userProfileDefaultTab || 'statuses'
} }
}, },
methods: { methods: {
@ -191,7 +193,7 @@ const UserProfile = {
}, },
'$route.hash': function (newVal) { '$route.hash': function (newVal) {
const oldTab = this.tab const oldTab = this.tab
this.tab = newVal.replace(/^#/, '') || defaultTabKey this.tab = newVal.replace(/^#/, '') || this.defaultTabKey
this.onRouteChange(oldTab, this.tab) this.onRouteChange(oldTab, this.tab)
} }
}, },

View file

@ -806,6 +806,7 @@
"use_one_click_nsfw": "Open NSFW attachments with just one click", "use_one_click_nsfw": "Open NSFW attachments with just one click",
"user_mutes": "Users", "user_mutes": "Users",
"user_profiles": "User Profiles", "user_profiles": "User Profiles",
"user_profile_default_tab": "Default Tab on User Profile",
"user_settings": "User Settings", "user_settings": "User Settings",
"valid_until": "Valid until", "valid_until": "Valid until",
"values": { "values": {
@ -921,6 +922,9 @@
"socket_reconnected": "Realtime connection established", "socket_reconnected": "Realtime connection established",
"up_to_date": "Up-to-date" "up_to_date": "Up-to-date"
}, },
"toast": {
"no_translation_target_set": "No translation target language set - this may fail. Please set a target language in your settings."
},
"tool_tip": { "tool_tip": {
"accept_follow_request": "Accept follow request", "accept_follow_request": "Accept follow request",
"add_reaction": "Add Reaction", "add_reaction": "Add Reaction",

View file

@ -116,7 +116,8 @@ export const defaultState = {
conversationTreeFadeAncestors: undefined, // instance default conversationTreeFadeAncestors: undefined, // instance default
maxDepthInThread: undefined, // instance default maxDepthInThread: undefined, // instance default
translationLanguage: undefined, // instance default, translationLanguage: undefined, // instance default,
supportedTranslationLanguages: {} // instance default supportedTranslationLanguages: {}, // instance default
userProfileDefaultTab: 'statuses'
} }
// caching the instance default properties // caching the instance default properties