@appscode/design-system 2.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appscode/design-system",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "A design system for Appscode websites and dashboards made using Bulma",
5
5
  "main": "main.scss",
6
6
  "scripts": {
@@ -170,7 +170,7 @@ function notificationTime(time: number) {
170
170
  }
171
171
 
172
172
  .notification-content {
173
- width: calc(100% - 100px);
173
+ width: calc(100% - 60px);
174
174
  h6 {
175
175
  font-size: 14px;
176
176
  font-weight: 500;
@@ -14,13 +14,14 @@ interface FormatedOrgs extends User {
14
14
  }
15
15
 
16
16
  interface Props {
17
- user: User;
17
+ user: FormatedOrgs;
18
18
  serverDomain?: string;
19
19
  accountsDomain?: string;
20
20
  showAccountSwitcher?: boolean;
21
21
  organizations?: Array<FormatedOrgs>;
22
22
  showThemeMode?: boolean;
23
23
  isPlatformDomain?: boolean;
24
+ isLoggedinUserAdmin?: boolean;
24
25
  }
25
26
 
26
27
  const props = withDefaults(defineProps<Props>(), {
@@ -30,6 +31,7 @@ const props = withDefaults(defineProps<Props>(), {
30
31
  organizations: () => [],
31
32
  showThemeMode: false,
32
33
  isPlatformDomain: false,
34
+ isLoggedinUserAdmin: false,
33
35
  });
34
36
 
35
37
  const emit = defineEmits(["set:theme", "on-logout", "activeorg$set"]);
@@ -83,6 +85,8 @@ const setTheme = (val: string) => {
83
85
  emit("set:theme", val);
84
86
  };
85
87
 
88
+ const pathName = window.location.origin;
89
+
86
90
  watch(dropDownStatus, (n) => {
87
91
  if (n === "open") {
88
92
  nextTick(() => {
@@ -116,45 +120,71 @@ watch(dropDownStatus, (n) => {
116
120
  class="user-profile-wrapper"
117
121
  @mouseleave="onMouseLeave()"
118
122
  >
119
- <div class="profile-area">
120
- <div class="profile-photo">
121
- <img
122
- :src="user.avatar_url"
123
- alt="User Photo"
124
- class="width-32 height-32"
125
- />
126
- <button class="camera-icon"></button>
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"
128
+ >
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>
127
148
  </div>
128
- <div class="profile-info" style="width: calc(100% - 60px)">
149
+ </a>
150
+ <transition-group name="list" tag="ul" class="list-items py-2">
151
+ <li key="settings" v-if="serverDomain !== pathName">
129
152
  <a
130
- :href="`${serverDomain}/${user.username}`"
131
- :title="user.username.toUpperCase()"
132
- data-testid="user-profile-link"
133
- class="line-break-anywhere is-ellipsis-1 has-text-weight-medium"
134
- >{{ user.username }}</a
153
+ v-if="user.isPersonalAccount"
154
+ data-testid="user-settings-link"
155
+ :href="`${serverDomain}/user/settings/`"
135
156
  >
136
- <a :href="`mailto:${user.email}`"> {{ user.email }}</a>
137
- </div>
138
- </div>
139
- <transition-group
140
- name="list"
141
- tag="ul"
142
- class="list-items py-2 ac-scrollbar px-0"
143
- >
144
- <li key="settings">
157
+ <span class="icon"><HeroiconsCog6Tooth /></span>
158
+ <span>Settings</span>
159
+ </a>
145
160
  <a
161
+ v-else
146
162
  data-testid="user-settings-link"
147
- :href="`${serverDomain}/user/settings/`"
148
- ><span class="icon"><HeroiconsCog6Tooth /></span
149
- ><span>Settings</span></a
163
+ :href="`${serverDomain}/${user.username}/settings`"
150
164
  >
165
+ <span class="icon"><HeroiconsCog6Tooth /></span
166
+ ><span>Settings</span>
167
+ </a>
151
168
  </li>
152
- <li v-if="user.is_admin" key="site-admin">
153
- <a data-testid="site-admin-link" :href="`${accountsDomain}/admin`"
154
- ><span class="icon"><HeroiconsWrenchScrewdriver /></span
155
- ><span>Site Administration</span></a
169
+ <li key="settings-platform" v-else>
170
+ <NuxtLink
171
+ v-if="user.isPersonalAccount"
172
+ data-testid="user-settings-link"
173
+ :to="`/user/settings/`"
156
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>
157
186
  </li>
187
+
158
188
  <li
159
189
  v-if="showAccountSwitcher"
160
190
  :class="`is-${dropDownStatus}`"
@@ -226,6 +256,12 @@ watch(dropDownStatus, (n) => {
226
256
  </li>
227
257
  </transition-group>
228
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>
229
265
  <li key="signout" @click="$emit('on-logout')">
230
266
  <a
231
267
  data-testid="user-logout-link"