@appscode/design-system 1.1.0 → 2.0.1

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