Skip to content

Commit

Permalink
Merge branch 'feat/update-settings-sidebar' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuseduardomedeiros committed Aug 30, 2024
2 parents 8f2c44d + 106579a commit fc6e777
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ export JSON_STRING='window.configs = { \
"NEXUS_API":"'${NEXUS_API}'", \
"VITE_HOTJAR_ID":"'${VITE_HOTJAR_ID}'", \
"VITE_BILLING_API_URL":"'${VITE_BILLING_API_URL}'", \
"VITE_CHATS_API_URL":"'${VITE_CHATS_API_URL}'", \
"GITHUB_API":"'${GITHUB_API}'", \
"GITHUB_CONTENT_API":"'${GITHUB_CONTENT_API}'", \
"GITHUB_PLATFORM_UPDATES_REPOSITORY":"'${GITHUB_PLATFORM_UPDATES_REPOSITORY}'", \
"VITE_CHATS_API_URL":"'${VITE_CHATS_API_URL}'", \
}'
sed "s|\/\/CONFIGURATIONS_PLACEHOLDER|${JSON_STRING}|" /usr/share/nginx/html/connect/index.html.tmpl > /tmp/index.html

Expand Down
5 changes: 5 additions & 0 deletions src/locales/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -6230,6 +6230,11 @@
}
},
"settings": {
"sector": {
"pt-br": "Setor",
"en": "Sector",
"es": "Sector"
},
"project": {
"title": {
"pt-br": "Projeto",
Expand Down
7 changes: 7 additions & 0 deletions src/utils/array.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export function sortByKey(arr, key, order = 'asc') {
const compareString = arr.every((item) => typeof item[key] === 'string');
const ordenedArr = compareString
? arr.sort((a, b) => a[key].localeCompare(b[key]))
: arr.toSorted((a, b) => a[key] - b[key]);
return order === 'desc' ? ordenedArr.reverse() : ordenedArr;
}
22 changes: 20 additions & 2 deletions src/views/settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import ExternalSystem from '../components/ExternalSystem.vue';
import getEnv from '@/utils/env';
import { PROJECT_ROLE_CHATUSER } from '../components/users/permissionsObjects';
import chats from '../api/chats';
import { sortByKey } from '@/utils/array';

export default {
name: 'SettingsView',
Expand Down Expand Up @@ -168,14 +169,18 @@ export default {
methods: {
async getChatsSectors() {
const sectors = (await chats.listAllSectors()).results;
this.chatsSectorRoutes = sectors.map((sector) => ({

const sectorRoutes = sectors.map((sector) => ({
key: sector.uuid,
label: `Setor ${sector.name}`,
label: `${this.$t('settings.sector')} ${sector.name}`,
hrefForceReload: {
name: 'settingsChats',
params: { internal: ['r', 'settings', 'sectors', sector.uuid] },
},
}));

this.chatsSectorRoutes = sortByKey(sectorRoutes, 'label');

this.initialLoaded = true;
},

Expand All @@ -201,6 +206,19 @@ export default {

display: flex;

:deep(.unnnic-sidebar-items) {
position: relative;
margin-right: -$unnnic-spacing-sm;
}

:deep(.unnnic-sidebar-item) {
margin-right: $unnnic-spacing-sm;
}

:deep(.unnnic-sidebar-item-child) {
margin-right: $unnnic-spacing-sm;
}

.options {
width: 200px;
height: fit-content;
Expand Down

0 comments on commit fc6e777

Please sign in to comment.