@appscode/design-system 1.1.0-alpha.9 → 1.1.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/base/utilities/_all.scss +1 -1
  2. package/base/utilities/_default.scss +41 -41
  3. package/base/utilities/_derived-variables.scss +8 -9
  4. package/base/utilities/_extended.scss +1 -1
  5. package/base/utilities/_initial-variables.scss +52 -50
  6. package/base/utilities/_mixin.scss +11 -11
  7. package/base/utilities/_typography.scss +22 -22
  8. package/base/utilities/dark-theme.scss +1 -1
  9. package/components/_ac-accordion.scss +6 -6
  10. package/components/_ac-alert-box.scss +27 -28
  11. package/components/_ac-calendar.scss +4 -4
  12. package/components/_ac-card.scss +55 -55
  13. package/components/_ac-code-highlight.scss +6 -6
  14. package/components/_ac-content-layout.scss +165 -165
  15. package/components/_ac-drag.scss +11 -11
  16. package/components/_ac-input.scss +85 -85
  17. package/components/_ac-modal.scss +8 -8
  18. package/components/_ac-multi-select.scss +751 -751
  19. package/components/_ac-options.scss +12 -13
  20. package/components/_ac-select-box.scss +5 -5
  21. package/components/_ac-table.scss +55 -55
  22. package/components/_ac-tabs.scss +36 -36
  23. package/components/_ac-tags.scss +22 -22
  24. package/components/_ac-terminal.scss +253 -253
  25. package/components/_add-card.scss +3 -3
  26. package/components/_app-drawer.scss +4 -4
  27. package/components/_basic-card.scss +108 -118
  28. package/components/_breadcumb.scss +5 -5
  29. package/components/_buttons.scss +64 -64
  30. package/components/_card-body-wrapper.scss +5 -5
  31. package/components/_dashboard-header.scss +29 -29
  32. package/components/_direct-deploy.scss +8 -8
  33. package/components/_go-to-top.scss +1 -1
  34. package/components/_image-upload.scss +3 -3
  35. package/components/_left-sidebar-menu.scss +374 -376
  36. package/components/_monaco-editor.scss +1 -1
  37. package/components/_navbar.scss +65 -65
  38. package/components/_nested-list.scss +1 -1
  39. package/components/_overview-info.scss +7 -7
  40. package/components/_overview-page.scss +4 -4
  41. package/components/_pagination.scss +110 -110
  42. package/components/_payment-card.scss +20 -20
  43. package/components/_preloader.scss +1 -1
  44. package/components/_preview-modal.scss +18 -18
  45. package/components/_pricing-table.scss +10 -10
  46. package/components/_progress-bar.scss +12 -12
  47. package/components/_subscription-card.scss +14 -14
  48. package/components/_table-of-content.scss +4 -4
  49. package/components/_tfa.scss +9 -9
  50. package/components/_widget-menu.scss +17 -17
  51. package/components/_wizard.scss +82 -82
  52. package/components/ac-toaster/_ac-toasted.scss +1 -1
  53. package/components/bbum/_activities-header.scss +1 -1
  54. package/components/bbum/_card-team.scss +12 -12
  55. package/components/bbum/_information-center.scss +13 -13
  56. package/components/bbum/_left-sidebar.scss +8 -8
  57. package/components/bbum/_mobile-desktop.scss +7 -7
  58. package/components/bbum/_post.scss +5 -5
  59. package/components/bbum/_sign-up-notification.scss +10 -10
  60. package/components/bbum/_single-post-preview.scss +21 -21
  61. package/components/bbum/_user-profile.scss +10 -10
  62. package/components/ui-builder/_ui-builder.scss +15 -15
  63. package/components/ui-builder/_vue-open-api.scss +2 -2
  64. package/layouts/_code-preview.scss +11 -11
  65. package/package.json +1 -1
  66. package/vue-components/plugins/time-convert.js +49 -0
  67. package/vue-components/text.vue +1 -0
  68. package/vue-components/types/cluster.ts +6 -0
  69. package/vue-components/types/longRunningTasks.ts +20 -0
  70. package/vue-components/types/notification.ts +6 -0
  71. package/vue-components/types/previewYaml.ts +8 -0
  72. package/vue-components/types/table.ts +54 -0
  73. package/vue-components/types/theme.ts +10 -0
  74. package/vue-components/types/user.ts +22 -0
  75. package/vue-components/v2/card/OverviewCards.vue +17 -2
  76. package/vue-components/v2/editor/ResourceKeyValueEditor.vue +21 -21
  77. package/vue-components/v2/icons/Ellipsis.vue +2 -1
  78. package/vue-components/v2/modal/Modal.vue +0 -5
  79. package/vue-components/v2/navbar/Appdrawer.vue +37 -12
  80. package/vue-components/v2/navbar/Navbar.vue +3 -3
  81. package/vue-components/v2/navbar/NavbarItem.vue +3 -1
  82. package/vue-components/v2/navbar/NavbarItemContent.vue +1 -1
  83. package/vue-components/v2/navbar/User.vue +5 -22
  84. package/vue-components/v2/pagination/Pagination.vue +65 -0
  85. package/vue-components/v2/sidebar/SidebarItem.vue +10 -7
  86. package/vue-components/v3/accordion/Accordion.vue +151 -0
  87. package/vue-components/v3/alert/Alert.vue +238 -0
  88. package/vue-components/v3/alert/Toast.vue +79 -0
  89. package/vue-components/v3/banner/Banner.vue +10 -0
  90. package/vue-components/v3/breadcrumbs/Breadcrumb.vue +104 -0
  91. package/vue-components/v3/button/Button.vue +831 -58
  92. package/vue-components/v3/button/Buttons.vue +6 -0
  93. package/vue-components/v3/button/DownloadBtn.vue +31 -0
  94. package/vue-components/v3/cards/Card.vue +32 -0
  95. package/vue-components/v3/cards/CardContent.vue +7 -0
  96. package/vue-components/v3/cards/CardHeader.vue +14 -0
  97. package/vue-components/v3/cards/Cards.vue +7 -0
  98. package/vue-components/v3/cards/Cluster.vue +150 -0
  99. package/vue-components/v3/cards/Counter.vue +27 -0
  100. package/vue-components/v3/cards/FeatureCard.vue +40 -0
  101. package/vue-components/v3/cards/FeatureCards.vue +6 -0
  102. package/vue-components/v3/cards/InfoCard.vue +248 -0
  103. package/vue-components/v3/cards/Monitoring.vue +94 -0
  104. package/vue-components/v3/cards/OverviewCard.vue +24 -0
  105. package/vue-components/v3/cards/OverviewCards.vue +31 -0
  106. package/vue-components/v3/cards/Payment.vue +62 -0
  107. package/vue-components/v3/cards/Vendor.vue +23 -0
  108. package/vue-components/v3/content/ContentHeader.vue +39 -30
  109. package/vue-components/v3/content/ContentLayout.vue +20 -0
  110. package/vue-components/v3/content/ContentTable.vue +37 -61
  111. package/vue-components/v3/dropdown/DropdownDivider.vue +2 -0
  112. package/vue-components/v3/dropdown/DropdownItem.vue +2 -0
  113. package/vue-components/v3/dropdown/DropdownMenu.vue +85 -91
  114. package/vue-components/v3/editor/Editor.vue +100 -113
  115. package/vue-components/v3/editor/FilteredFileEditor.vue +124 -127
  116. package/vue-components/v3/editor/ResourceKeyValueEditor.vue +70 -94
  117. package/vue-components/v3/footer/FooterArea.vue +34 -0
  118. package/vue-components/v3/footer/FooterItem.vue +29 -0
  119. package/vue-components/v3/footer/FooterItems.vue +15 -0
  120. package/vue-components/v3/footer/Info.vue +23 -0
  121. package/vue-components/v3/footer/Status.vue +42 -0
  122. package/vue-components/v3/footer/Usage.vue +44 -0
  123. package/vue-components/v3/form/Form.vue +24 -33
  124. package/vue-components/v3/form/FormFooterControl.vue +7 -0
  125. package/vue-components/v3/form/FormFooterControls.vue +7 -0
  126. package/vue-components/v3/form-fields/AcSingleInput.vue +520 -0
  127. package/vue-components/v3/form-fields/Input.vue +19 -14
  128. package/vue-components/v3/header/Header.vue +117 -24
  129. package/vue-components/v3/header/HeaderItem.vue +18 -0
  130. package/vue-components/v3/header/HeaderItems.vue +4 -0
  131. package/vue-components/v3/icons/Ellipsis.vue +2 -0
  132. package/vue-components/v3/loaders/ResourceLoader.vue +4 -12
  133. package/vue-components/v3/loaders/SidebarLoader.vue +4 -12
  134. package/vue-components/v3/long-running-tasks/LongRunningTaskItem.vue +17 -15
  135. package/vue-components/v3/modal/Modal.vue +292 -96
  136. package/vue-components/v3/modals/DeleteConfirmationModal.vue +37 -50
  137. package/vue-components/v3/modals/JsonShowModal.vue +62 -68
  138. package/vue-components/v3/modals/LongRunningTasksModal.vue +145 -143
  139. package/vue-components/v3/navbar/Appdrawer.vue +196 -51
  140. package/vue-components/v3/navbar/Navbar.vue +296 -0
  141. package/vue-components/v3/navbar/NavbarItem.vue +81 -0
  142. package/vue-components/v3/navbar/NavbarItemContent.vue +284 -0
  143. package/vue-components/v3/navbar/Notification.vue +179 -0
  144. package/vue-components/v3/navbar/ThemeMode.vue +128 -112
  145. package/vue-components/v3/navbar/User.vue +383 -268
  146. package/vue-components/v3/notification/AlertBox.vue +39 -42
  147. package/vue-components/v3/notification/Notification.vue +49 -43
  148. package/vue-components/v3/notification/NotificationItem.vue +51 -19
  149. package/vue-components/v3/option-dots/Options.vue +188 -0
  150. package/vue-components/v3/pagination/Pagination.vue +203 -99
  151. package/vue-components/v3/preloader/Preloader.vue +23 -0
  152. package/vue-components/v3/searchbars/SearchBar.vue +51 -34
  153. package/vue-components/v3/sidebar/AccentColorPicker.vue +97 -0
  154. package/vue-components/v3/sidebar/ClusterSwitcher.vue +834 -81
  155. package/vue-components/v3/sidebar/Sidebar.vue +271 -0
  156. package/vue-components/v3/sidebar/SidebarBody.vue +7 -0
  157. package/vue-components/v3/sidebar/SidebarFooter.vue +80 -0
  158. package/vue-components/v3/sidebar/SidebarHeader.vue +124 -0
  159. package/vue-components/v3/sidebar/SidebarItem.vue +62 -0
  160. package/vue-components/v3/sidebar/SidebarItemWithDropDown.vue +101 -104
  161. package/vue-components/v3/sidebar/SidebarMenuList.vue +9 -0
  162. package/vue-components/v3/sidebar/sidebar-tabs/SidebarTabs.vue +128 -0
  163. package/vue-components/v3/sidebar/sidebar-tabs/SidebarTabsLayout.vue +29 -0
  164. package/vue-components/v3/sidebar/sidebar-tabs/TabsContent.vue +99 -0
  165. package/vue-components/v3/tab/TabItem.vue +10 -12
  166. package/vue-components/v3/tab/Tabs.vue +9 -0
  167. package/vue-components/v3/tab/TabsBody.vue +7 -0
  168. package/vue-components/v3/table/EmptyTableInfo.vue +8 -0
  169. package/vue-components/v3/table/FakeTableCell.vue +22 -31
  170. package/vue-components/v3/table/InfoTable.vue +85 -59
  171. package/vue-components/v3/table/MultiInfoTable.vue +72 -95
  172. package/vue-components/v3/table/Table.vue +582 -151
  173. package/vue-components/v3/table/TableCell.vue +20 -23
  174. package/vue-components/v3/table/TableContainer.vue +50 -28
  175. package/vue-components/v3/table/TableRow.vue +63 -85
  176. package/vue-components/v3/table/table-cell/ArrayCell.vue +67 -79
  177. package/vue-components/v3/table/table-cell/CellValue.vue +97 -103
  178. package/vue-components/v3/table/table-cell/GenericCell.vue +43 -42
  179. package/vue-components/v3/table/table-cell/ObjectCell.vue +67 -79
  180. package/vue-components/v3/table/table-cell/ValueWithModal.vue +22 -31
  181. package/vue-components/v3/tabs/EditorTabs.vue +18 -24
  182. package/vue-components/v3/tag/Tag.vue +15 -12
  183. package/vue-components/v3/tag/Tags.vue +7 -0
  184. package/vue-components/v3/terminal/LongRunningTaskTerminal.vue +26 -23
  185. package/mixins/stickyContent.js +0 -141
  186. package/plugins/caching.ts +0 -243
@@ -1,283 +1,249 @@
1
+ <script setup lang="ts">
2
+ import { defineAsyncComponent, ref, watch, computed, nextTick } from "vue";
3
+ import type { User, Organization } from "../../types/user";
4
+
5
+ interface FormatedOrgs extends Organization {
6
+ isPersonalAccount?: boolean;
7
+ }
8
+
9
+ interface Props {
10
+ user: User;
11
+ serverDomain?: string;
12
+ accountsDomain?: string;
13
+ showAccountSwitcher?: boolean;
14
+ organizations?: Array<FormatedOrgs>;
15
+ showThemeMode?: boolean;
16
+ isPlatformDomain?: boolean;
17
+ }
18
+
19
+ const props = withDefaults(defineProps<Props>(), {
20
+ serverDomain: "",
21
+ accountsDomain: "",
22
+ showAccountSwitcher: false,
23
+ organizations: () => [],
24
+ showThemeMode: false,
25
+ isPlatformDomain: false,
26
+ });
27
+
28
+ const emit = defineEmits(["set:theme", "on-logout", "activeorg$set"]);
29
+
30
+ const NavbarItem = defineAsyncComponent(
31
+ () => import("../navbar/NavbarItem.vue")
32
+ );
33
+ const NavbarItemContent = defineAsyncComponent(
34
+ () => import("../navbar/NavbarItemContent.vue")
35
+ );
36
+
37
+ const ThemeMode = defineAsyncComponent(() => import("../navbar/ThemeMode.vue"));
38
+
39
+ const dropDownStatus = ref("close");
40
+ const dropDownSectionHeight = ref<string | null>(null);
41
+ const dropdownItems = ref(null as { $el: HTMLElement } | null);
42
+
43
+ const formattedOrganizations = computed(() => {
44
+ let activeUser: User | undefined = undefined;
45
+ const filteredList = props.organizations.filter((item) => {
46
+ if (item.username === props.user.username) {
47
+ activeUser = item;
48
+ } else {
49
+ return true;
50
+ }
51
+ return false;
52
+ });
53
+
54
+ if (activeUser) filteredList.unshift(activeUser);
55
+
56
+ return filteredList || [];
57
+ });
58
+
59
+ const toggleList = () => {
60
+ dropDownStatus.value = dropDownStatus.value === "open" ? "close" : "open";
61
+ nextTick(() => {
62
+ dropdownItems.value?.$el.scrollTo(0, 0);
63
+ });
64
+ };
65
+
66
+ const onOrganizationClick = (orgName: string) => {
67
+ dropdownItems.value?.$el.scrollTo(0, 0);
68
+ emit("activeorg$set", orgName);
69
+ };
70
+
71
+ const onMouseLeave = () => {
72
+ dropDownStatus.value = "close";
73
+ };
74
+
75
+ const setTheme = (val: string) => {
76
+ emit("set:theme", val);
77
+ };
78
+
79
+ watch(dropDownStatus, (n) => {
80
+ if (n === "open") {
81
+ nextTick(() => {
82
+ const dropDownUl = dropdownItems.value;
83
+ if (dropDownUl)
84
+ dropDownSectionHeight.value = `${dropDownUl.$el.scrollHeight}px`;
85
+ });
86
+ } else {
87
+ dropDownSectionHeight.value = null;
88
+ }
89
+ });
90
+ </script>
91
+
1
92
  <template>
2
- <navbar-item>
3
- <button class="button ac-nav-button ac-profile-button">
93
+ <navbar-item :modifierClasses="'ac-profile-button'">
94
+ <template #navbar-item>
95
+ <div class="ac-user-profile mr-8">
96
+ <img :src="(user.avatar_url as string)" alt="User Photo" />
97
+ </div>
4
98
  {{ user.full_name || user.username }}
5
99
  <i class="fa fa-angle-down" aria-hidden="true"></i>
6
- <div class="ac-user-profile">
7
- <img :src="user.avatar_url" alt="User Photo" />
8
- </div>
9
- </button>
10
- <navbar-item-content class="navbar-dropdown-wrapper">
11
- <div
12
- v-if="user.username"
13
- class="user-profile-wrapper"
14
- @mouseleave="onMouseLeave()"
15
- >
16
- <div class="profile-area">
17
- <div class="profile-photo">
18
- <img
19
- :src="user.avatar_url"
20
- alt="User Photo"
21
- class="width-50 height-50"
22
- />
23
- <button class="camera-icon"></button>
24
- </div>
25
- <div class="profile-info" style="width: calc(100% - 60px)">
26
- <a
27
- :href="`${serverDomain}/${user.username}`"
28
- :title="user.username.toUpperCase()"
29
- data-testid="user-profile-link"
30
- class="line-break-anywhere is-ellipsis-1"
31
- >{{ user.username.toUpperCase() }}</a
32
- >
33
- <a :href="`mailto:${user.email}`"> {{ user.email }}</a>
100
+ </template>
101
+ <!-- <button class="button ac-nav-button ac-profile-button">
102
+
103
+ </button> -->
104
+
105
+ <template #navbar-content>
106
+ <navbar-item-content class="navbar-dropdown-wrapper">
107
+ <div
108
+ v-if="user.username"
109
+ class="user-profile-wrapper"
110
+ @mouseleave="onMouseLeave()"
111
+ >
112
+ <div class="profile-area">
113
+ <div class="profile-photo">
114
+ <img
115
+ :src="user.avatar_url"
116
+ alt="User Photo"
117
+ class="width-32 height-32"
118
+ />
119
+ <button class="camera-icon"></button>
120
+ </div>
121
+ <div class="profile-info" style="width: calc(100% - 60px)">
122
+ <a
123
+ :href="`${serverDomain}/${user.username}`"
124
+ :title="user.username.toUpperCase()"
125
+ data-testid="user-profile-link"
126
+ class="line-break-anywhere is-ellipsis-1 has-text-weight-medium"
127
+ >{{ user.username }}</a
128
+ >
129
+ <a :href="`mailto:${user.email}`"> {{ user.email }}</a>
130
+ </div>
34
131
  </div>
35
- </div>
36
- <transition-group name="list" tag="ul">
37
- <li key="settings">
38
- <a
39
- data-testid="user-settings-link"
40
- :href="`${serverDomain}/user/settings/`"
41
- >Settings</a
42
- >
43
- </li>
44
- <li v-if="user.is_admin" key="site-admin">
45
- <a data-testid="site-admin-link" :href="`${accountsDomain}/admin`"
46
- >Site Administration</a
47
- >
48
- </li>
49
- <li
50
- v-if="showAccountSwitcher"
51
- :class="`is-${dropDownStatus}`"
52
- key="switcher"
53
- >
54
- <a
55
- class="
56
- ac-dropdown-button
57
- is-fullwidth
58
- is-flex
59
- is-justify-content-space-between
60
- is-align-items-center
61
- "
62
- @click="toggleList()"
63
- >
64
- <span>Switch Account</span>
65
- <span
66
- ><i
67
- :class="`fa fa-angle-${
68
- dropDownStatus === 'open' ? 'up' : 'down'
69
- }`"
70
- ></i
71
- ></span>
72
- </a>
73
- <transition-group
74
- name="list"
75
- tag="ul"
76
- class="ac-vscrollbar"
77
- ref="dropdownItems"
78
- :style="{ maxHeight: dropDownSectionHeight }"
132
+ <transition-group name="list" tag="ul" class="list-items">
133
+ <li key="settings">
134
+ <a
135
+ data-testid="user-settings-link"
136
+ :href="`${serverDomain}/user/settings/`"
137
+ >Settings</a
138
+ >
139
+ </li>
140
+ <li v-if="user.is_admin" key="site-admin">
141
+ <a data-testid="site-admin-link" :href="`${accountsDomain}/admin`"
142
+ >Site Administration</a
143
+ >
144
+ </li>
145
+ <li
146
+ v-if="showAccountSwitcher"
147
+ :class="`is-${dropDownStatus}`"
148
+ key="switcher"
79
149
  >
80
- <li
81
- v-for="(org, idx) in formattedOrganizations"
82
- :key="org.username"
150
+ <a
151
+ class="ac-dropdown-button is-fullwidth is-flex is-justify-content-space-between is-align-items-center"
152
+ @click="toggleList()"
83
153
  >
84
- <a
85
- class="is-flex is-align-items-center"
86
- @click="onOrganizationClick(org.username)"
154
+ <span>Switch Account</span>
155
+ <span
156
+ ><i
157
+ :class="`fa fa-angle-${
158
+ dropDownStatus === 'open' ? 'up' : 'down'
159
+ }`"
160
+ ></i
161
+ ></span>
162
+ </a>
163
+ <transition-group
164
+ name="list"
165
+ tag="ul"
166
+ class="ac-vscrollbar"
167
+ ref="dropdownItems"
168
+ :style="{ maxHeight: dropDownSectionHeight }"
169
+ >
170
+ <li
171
+ v-for="(org, idx) in formattedOrganizations"
172
+ :key="org.username"
87
173
  >
88
- <div class="width-30 height-30 image">
89
- <img
90
- :src="org.avatar_url"
91
- class="ac-user-profile is-rounded"
92
- alt="icon"
93
- />
94
- </div>
95
- <div
96
- class="
97
- is-flex
98
- is-align-items-center
99
- is-justify-content-space-between
100
- is-fullwidth
101
- ml-10
102
- "
174
+ <a
175
+ class="is-flex is-align-items-center"
176
+ @click="onOrganizationClick(org.username)"
103
177
  >
104
- <div class="org-info">
105
- <strong
106
- :title="org.username"
107
- class="line-break-anywhere is-ellipsis-1"
108
- >{{ org.username }}</strong
109
- >
110
- <p>
111
- {{
112
- org.isPersonalAccount
113
- ? "Personal Account"
114
- : "Organization"
115
- }}
116
- </p>
178
+ <div class="width-30 height-30 image">
179
+ <img
180
+ :src="org.avatar_url"
181
+ class="ac-user-profile is-rounded"
182
+ alt="icon"
183
+ />
117
184
  </div>
118
- <span
119
- v-if="idx === 0"
120
- class="
121
- material-icons-outlined
122
- font-size-18
123
- ml-10
124
- is-pulled-right
125
- "
185
+ <div
186
+ class="is-flex is-align-items-center is-justify-content-space-between is-fullwidth ml-10"
126
187
  >
127
- check
128
- </span>
129
- </div>
130
- </a>
131
- </li>
132
- </transition-group>
133
- </li>
134
- <li key="dashboard">
135
- <nuxt-link
136
- v-if="isPlatformDomain"
137
- to="/dashboard"
138
- data-testid="user-dashboard-link"
139
- >
140
- Dashboard
141
- </nuxt-link>
142
- <a
143
- v-else
144
- :href="`${serverDomain}/dashboard`"
145
- data-testid="user-dashboard-link"
146
- >
147
- Dashboard
148
- </a>
149
- </li>
150
- <li key="signout" @click="$emit('on-logout')">
151
- <a
152
- data-testid="user-logout-link"
153
- :href="`${accountsDomain}/user/logout`"
154
- >
155
- Sign out
156
- </a>
157
- </li>
158
- <li key="theme" v-if="showThemeMode">
159
- <theme-mode @set:theme="setTheme" />
160
- </li>
161
- </transition-group>
162
- </div>
163
- </navbar-item-content>
188
+ <div class="org-info">
189
+ <strong
190
+ :title="org.username"
191
+ class="line-break-anywhere is-ellipsis-1"
192
+ >{{ org.username }}</strong
193
+ >
194
+ <p>
195
+ {{
196
+ org.isPersonalAccount
197
+ ? "Personal Account"
198
+ : "Organization"
199
+ }}
200
+ </p>
201
+ </div>
202
+ <span
203
+ v-if="idx === 0"
204
+ class="material-icons font-size-18 ml-10 is-pulled-right"
205
+ >
206
+ check
207
+ </span>
208
+ </div>
209
+ </a>
210
+ </li>
211
+ </transition-group>
212
+ </li>
213
+ <li key="dashboard">
214
+ <router-link
215
+ v-if="isPlatformDomain"
216
+ to="/dashboard"
217
+ data-testid="user-dashboard-link"
218
+ >
219
+ Dashboard
220
+ </router-link>
221
+ <a
222
+ v-else
223
+ :href="`${serverDomain}/dashboard`"
224
+ data-testid="user-dashboard-link"
225
+ >
226
+ Dashboard
227
+ </a>
228
+ </li>
229
+ <li key="signout" @click="$emit('on-logout')">
230
+ <a
231
+ data-testid="user-logout-link"
232
+ :href="`${accountsDomain}/user/logout`"
233
+ >
234
+ Sign out
235
+ </a>
236
+ </li>
237
+ <li key="theme" v-if="showThemeMode">
238
+ <theme-mode @set:theme="setTheme" />
239
+ </li>
240
+ </transition-group>
241
+ </div>
242
+ </navbar-item-content>
243
+ </template>
164
244
  </navbar-item>
165
245
  </template>
166
246
 
167
- <script>
168
- import { defineComponent, defineAsyncComponent } from "vue";
169
-
170
- export default defineComponent({
171
- props: {
172
- // active user info
173
- user: {
174
- type: Object,
175
- default: () => ({}),
176
- },
177
- serverDomain: {
178
- type: String,
179
- default: "",
180
- },
181
- accountsDomain: {
182
- type: String,
183
- default: "",
184
- },
185
- showAccountSwitcher: {
186
- type: Boolean,
187
- default: false,
188
- },
189
- // all available organization list including personal account
190
- organizations: {
191
- type: Array,
192
- default: () => [],
193
- },
194
- showThemeMode: {
195
- type: Boolean,
196
- default: false,
197
- },
198
- isPlatformDomain: {
199
- type: Boolean,
200
- default: false,
201
- },
202
- },
203
- emits: ["set:theme", "on-logout"],
204
-
205
- components: {
206
- NavbarItem: defineAsyncComponent(() =>
207
- import("../../v2/navbar/NavbarItem.vue").then((module) => module.default)
208
- ),
209
- NavbarItemContent: defineAsyncComponent(() =>
210
- import("../../v2/navbar/NavbarItemContent.vue").then(
211
- (module) => module.default
212
- )
213
- ),
214
- ThemeMode: defineAsyncComponent(() =>
215
- import("../../v3/navbar/ThemeMode.vue").then((module) => module.default)
216
- ),
217
- },
218
-
219
- computed: {
220
- formattedOrganizations() {
221
- let activeUser;
222
- const filteredList = this.organizations.filter((item) => {
223
- if (item.username === this.user.username) {
224
- activeUser = item;
225
- } else {
226
- return true;
227
- }
228
- return false;
229
- });
230
-
231
- filteredList.unshift(activeUser);
232
-
233
- return filteredList || [];
234
- },
235
- },
236
-
237
- data() {
238
- return {
239
- dropDownStatus: "close",
240
- dropDownSectionHeight: null,
241
- };
242
- },
243
-
244
- methods: {
245
- toggleList() {
246
- this.dropDownStatus = this.dropDownStatus === "open" ? "close" : "open";
247
- this.$nextTick(() => {
248
- this.$refs["dropdownItems"].$el.scrollTo(0, 0);
249
- });
250
- },
251
- onOrganizationClick(orgName) {
252
- this.$refs["dropdownItems"].$el.scrollTo(0, 0);
253
- this.$emit("activeorg$set", orgName);
254
- },
255
- onMouseLeave() {
256
- this.dropDownStatus = "close";
257
- },
258
- setTheme(val) {
259
- this.$emit("set:theme", val);
260
- },
261
- },
262
-
263
- watch: {
264
- dropDownStatus: {
265
- immediate: true,
266
- handler(n) {
267
- if (n === "open") {
268
- this.$nextTick(() => {
269
- const dropDownUl = this.$refs["dropdownItems"];
270
- if (dropDownUl)
271
- this.dropDownSectionHeight = `${dropDownUl.scrollHeight}px`;
272
- });
273
- } else {
274
- this.dropDownSectionHeight = null;
275
- }
276
- },
277
- },
278
- },
279
- });
280
- </script>
281
247
  <style lang="scss" scoped>
282
248
  .ac-vscrollbar {
283
249
  overflow: auto !important;
@@ -285,4 +251,153 @@ export default defineComponent({
285
251
  .line-break-anywhere {
286
252
  line-break: anywhere;
287
253
  }
288
- </style>
254
+ .navbar-dropdown-wrapper {
255
+ width: 240px;
256
+ transition: width 0.9s ease-in-out;
257
+ }
258
+
259
+ .user-profile-wrapper {
260
+ background-color: $white-100;
261
+ border-radius: 4px;
262
+ border: 1px solid $primary-90;
263
+
264
+ .profile-area {
265
+ display: flex;
266
+ align-items: center;
267
+ border-bottom: 1px solid $primary-90;
268
+ padding: 8px 16px;
269
+
270
+ .profile-photo {
271
+ // width: 50px;
272
+ // height: 50px;
273
+ border-radius: 50%;
274
+ position: relative;
275
+ z-index: 1;
276
+ margin-right: 10px;
277
+
278
+ img {
279
+ border-radius: 50%;
280
+ width: 100%;
281
+ border: 2px solid #d2e7f9;
282
+ }
283
+
284
+ .camera-icon {
285
+ position: absolute;
286
+ right: -10px;
287
+ top: 0;
288
+ background-color: transparent;
289
+ border: none;
290
+ cursor: pointer;
291
+ }
292
+ }
293
+
294
+ .profile-info {
295
+ p {
296
+ color: $primary-10;
297
+ font-size: 13px;
298
+ font-weight: 500;
299
+ line-height: 1.3;
300
+ }
301
+
302
+ a {
303
+ font-size: 1rem;
304
+ color: $primary-20;
305
+ line-height: 1.3;
306
+ }
307
+ }
308
+ }
309
+ }
310
+
311
+ .ac-menu-item {
312
+ &.ac-profile-button {
313
+ margin-right: 15px;
314
+ button.button.ac-nav-button {
315
+ .ac-user-profile {
316
+ width: 32px;
317
+ height: 32px;
318
+ border-radius: 50%;
319
+ overflow: hidden;
320
+ border: 2px solid $primary-90;
321
+ }
322
+ i.fa {
323
+ padding-left: 8px;
324
+ }
325
+ }
326
+ }
327
+ }
328
+
329
+ .list-items {
330
+ li {
331
+ &.is-close {
332
+ ul {
333
+ max-height: 0;
334
+ visibility: hidden;
335
+ transition: max-height 0.25s ease-out;
336
+ &.ac-vscrollbar {
337
+ padding: 0;
338
+ }
339
+ }
340
+ }
341
+
342
+ &.is-open {
343
+ ul {
344
+ max-height: 200px;
345
+ visibility: visible;
346
+ transition: max-height 0.25s ease-out;
347
+ }
348
+ }
349
+ a {
350
+ padding: 6px 16px;
351
+ font-weight: 500;
352
+ display: block;
353
+ color: $primary-10;
354
+ transition: 0.3s;
355
+
356
+ &:hover {
357
+ background-color: $primary-97;
358
+ color: $primary;
359
+ }
360
+ }
361
+ }
362
+ }
363
+ .ac-menu-item {
364
+ .is-fullwidth {
365
+ width: 100%;
366
+ }
367
+ }
368
+ .ac-nav-button {
369
+ background-color: transparent;
370
+ border: none;
371
+ color: $primary-80;
372
+ padding: 0 14px;
373
+ margin-left: 15px;
374
+
375
+ // &.ac-profile-button {
376
+ // color: $primary-10;
377
+ // font-weight: 500;
378
+ // }
379
+
380
+ &:last-child {
381
+ margin-left: 0;
382
+ }
383
+
384
+ span {
385
+ position: absolute;
386
+ top: 5px;
387
+ right: 5px;
388
+ width: 15px;
389
+ height: 15px;
390
+ background-color: $white-100;
391
+ font-size: 12px;
392
+ line-height: 15px;
393
+ border-radius: 50%;
394
+ color: $primary;
395
+ z-index: 9;
396
+ }
397
+
398
+ &:focus {
399
+ outline: none;
400
+ box-shadow: none !important;
401
+ }
402
+ }
403
+ </style>