From 87e5fc6bf8b8f343bfd87ee0cb3920ed2b232836 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Sat, 1 Mar 2025 08:00:41 +0100 Subject: [PATCH] feat(webapp): implement configurable custom button in header (#8215) * Implement configurable custom button in header * Implement default values for 'headerMenu' --------- Co-authored-by: mahula --- .../components/CustomButton/CustomButton.vue | 74 +++++++++++++++++++ webapp/components/HeaderMenu/HeaderMenu.vue | 27 ++++++- webapp/constants/headerMenu.js | 14 +--- webapp/constants/headerMenuBranded.js | 27 +++++++ 4 files changed, 125 insertions(+), 17 deletions(-) create mode 100644 webapp/components/CustomButton/CustomButton.vue create mode 100644 webapp/constants/headerMenuBranded.js diff --git a/webapp/components/CustomButton/CustomButton.vue b/webapp/components/CustomButton/CustomButton.vue new file mode 100644 index 000000000..a5fd50c99 --- /dev/null +++ b/webapp/components/CustomButton/CustomButton.vue @@ -0,0 +1,74 @@ + + + + + diff --git a/webapp/components/HeaderMenu/HeaderMenu.vue b/webapp/components/HeaderMenu/HeaderMenu.vue index c1f13581d..26e6aede7 100644 --- a/webapp/components/HeaderMenu/HeaderMenu.vue +++ b/webapp/components/HeaderMenu/HeaderMenu.vue @@ -96,6 +96,10 @@ + + + + @@ -214,6 +218,18 @@ + + + +
+ +
+
+
@@ -271,9 +287,10 @@ import { SHOW_CONTENT_FILTER_HEADER_MENU } from '~/constants/filter.js' import LOGOS from '~/constants/logos.js' import AvatarMenu from '~/components/AvatarMenu/AvatarMenu' import ChatNotificationMenu from '~/components/ChatNotificationMenu/ChatNotificationMenu' +import CustomButton from '~/components/CustomButton/CustomButton' import FilterMenu from '~/components/FilterMenu/FilterMenu.vue' import GroupButton from '~/components/Group/GroupButton' -import headerMenu from '~/constants/headerMenu.js' +import headerMenuBranded from '~/constants/headerMenuBranded.js' import InviteButton from '~/components/InviteButton/InviteButton' import LocaleSwitch from '~/components/LocaleSwitch/LocaleSwitch' import Logo from '~/components/Logo/Logo' @@ -286,6 +303,8 @@ import PageParamsLink from '~/components/_new/features/PageParamsLink/PageParams export default { components: { AvatarMenu, + ChatNotificationMenu, + CustomButton, FilterMenu, GroupButton, InviteButton, @@ -295,7 +314,6 @@ export default { NotificationMenu, PageParamsLink, SearchField, - ChatNotificationMenu, }, props: { showMobileMenu: { type: Boolean, default: false }, @@ -309,8 +327,9 @@ export default { LOGOS, SHOW_GROUP_BUTTON_IN_HEADER, SHOW_CONTENT_FILTER_HEADER_MENU, - isHeaderMenu: headerMenu.MENU.length > 0, - menu: headerMenu.MENU, + isHeaderMenu: headerMenuBranded.MENU.length > 0, + customButton: headerMenuBranded.CUSTOM_BUTTON, + menu: headerMenuBranded.MENU, mobileSearchVisible: false, toggleMobileMenu: false, inviteRegistration: this.$env.INVITE_REGISTRATION === true, // for 'false' in .env INVITE_REGISTRATION is of type undefined and not(!) boolean false, because of internal handling, diff --git a/webapp/constants/headerMenu.js b/webapp/constants/headerMenu.js index aa87a598c..b1c6ea436 100644 --- a/webapp/constants/headerMenu.js +++ b/webapp/constants/headerMenu.js @@ -1,13 +1 @@ -export default { - MENU: [ - // { - // nameIdent: 'nameIdent', - // path: '/', - // }, - // { - // nameIdent: 'nameIdent', - // url: 'https://ocelot.social', - // target: '_blank', - // }, - ], -} +export default {} diff --git a/webapp/constants/headerMenuBranded.js b/webapp/constants/headerMenuBranded.js new file mode 100644 index 000000000..2acba99ed --- /dev/null +++ b/webapp/constants/headerMenuBranded.js @@ -0,0 +1,27 @@ +import { merge } from 'lodash' +import headerMenu from '~/constants/headerMenu.js' + +const defaultHeaderMenu = { + CUSTOM_BUTTON: { + // iconPath: '/img/custom/X', + // iconWidth: '28px', + // iconAltText: 'X', + // toolTipIdent: 'nameIdent', + // path: '/', + // url: 'https://ocelot.social/en/donate', + // target: '_blank', + }, + MENU: [ + // { + // nameIdent: 'nameIdent', + // path: '/', + // }, + // { + // nameIdent: 'nameIdent', + // url: 'https://ocelot.social', + // target: '_blank', + // }, + ], +} + +export default merge(defaultHeaderMenu, headerMenu)