Skip to content

Commit dfe12d4

Browse files
authored
feat: server access post release QA (#6316)
* fix: clicking users in table in app takes you to blank page instead of website * fix: wrong loader icon on server panel * fix: surface var misalignment * fix: password managers still detecting username field as something to autofill * feat: show users on backupitem components * feat: seperators for filter sections * fix: lint + change remove -> revoke * fix: copy * feat: align copy
1 parent c653228 commit dfe12d4

23 files changed

Lines changed: 287 additions & 81 deletions

File tree

‎apps/app-frontend/src/pages/hosting/manage/Access.vue‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
ServersManageAccessPage,
66
} from '@modrinth/ui'
77
import { useQueryClient } from '@tanstack/vue-query'
8+
import { openUrl } from '@tauri-apps/plugin-opener'
89
910
const client = injectModrinthClient()
1011
const { serverId } = injectModrinthServerContext()
@@ -26,8 +27,12 @@ try {
2627
} catch {
2728
// Let mounted layouts' useQuery surface errors; do not fail route setup.
2829
}
30+
31+
function userProfileLink(username: string) {
32+
return () => openUrl(`https://modrinth.com/user/${encodeURIComponent(username)}`)
33+
}
2934
</script>
3035

3136
<template>
32-
<ServersManageAccessPage />
37+
<ServersManageAccessPage :user-profile-link="userProfileLink" />
3338
</template>

‎packages/api-client/src/modules/archon/types.ts‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -858,29 +858,39 @@ export namespace Archon {
858858
id: string
859859
}
860860

861+
export type UserInfo = {
862+
id: string
863+
username: string
864+
avatar_url: string | null
865+
}
866+
861867
export type DeleteManyBackupRequest = {
862868
backup_ids: string[]
863869
}
864870

865871
export type ActiveOperation = {
866872
backup_id: string
867873
operation_type: BackupQueueOperationType
868-
operation_id?: number | null
874+
operation_id: number | null
869875
has_parent: boolean
870876
scheduled_for: string
877+
started_at: string | null
871878
synthetic_legacy: boolean
879+
user_info: UserInfo | null
872880
}
873881

874882
export type BackupQueueOperation = {
875883
operation_type: BackupQueueOperationType
876-
operation_id?: number | null
884+
operation_id: number | null
877885
state: BackupQueueState
878886
scheduled_for: string
879-
completed_at?: string | null
887+
started_at: string | null
888+
completed_at: string | null
880889
has_parent: boolean
881-
error?: string | null
890+
error: string | null
882891
should_prompt: boolean
883892
synthetic_legacy: boolean
893+
user_info: UserInfo | null
884894
}
885895

886896
export type BackupQueueBackup = {

‎packages/ui/src/components/base/Combobox.vue‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,16 @@
2020
ref="searchTriggerRef"
2121
v-model="searchQuery"
2222
:icon="showSearchIcon ? SearchIcon : undefined"
23-
type="text"
23+
:type="searchType"
24+
:name="searchName"
2425
:placeholder="searchPlaceholder || placeholder"
2526
:disabled="disabled"
2627
:autocomplete="searchAutocomplete"
2728
:autocorrect="searchAutocorrect"
2829
:autocapitalize="searchAutocapitalize"
2930
:spellcheck="searchSpellcheck"
31+
:inputmode="searchInputmode"
32+
:input-attrs="searchInputAttrs"
3033
wrapper-class="w-full !bg-transparent"
3134
:input-class="searchableInputClass"
3235
class="relative z-[1]"
@@ -281,19 +284,21 @@ const props = withDefaults(
281284
forceDirection?: 'up' | 'down'
282285
noOptionsMessage?: string
283286
disableSearchFilter?: boolean
284-
dropdownClass?: string
285-
dropdownMinWidth?: string
286287
minSearchLengthToOpen?: number
287288
/** Keep the selected option's label in the input after selection, and show all options on focus */
288289
syncWithSelection?: boolean
289290
/** Select the searchable input text when the field receives focus */
290291
selectSearchTextOnFocus?: boolean
291292
/** Show a search icon in the searchable input */
292293
showSearchIcon?: boolean
294+
searchType?: 'text' | 'search'
295+
searchName?: string
296+
searchInputmode?: 'text' | 'search'
293297
searchAutocomplete?: string
294298
searchAutocorrect?: 'on' | 'off'
295299
searchAutocapitalize?: 'none' | 'off' | 'sentences' | 'words' | 'characters'
296300
searchSpellcheck?: boolean
301+
searchInputAttrs?: Record<string, string | number | boolean | undefined>
297302
}>(),
298303
{
299304
placeholder: 'Select an option',
@@ -309,6 +314,7 @@ const props = withDefaults(
309314
syncWithSelection: true,
310315
selectSearchTextOnFocus: false,
311316
showSearchIcon: false,
317+
searchType: 'text',
312318
outsideClickIgnore: () => [],
313319
},
314320
)

‎packages/ui/src/components/base/DropdownFilterBar.vue‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,13 @@
269269
>
270270
<div
271271
v-if="isDropdownFilterSectionHeader(item)"
272-
class="flex items-center justify-between gap-3 px-4 py-2.5 text-sm font-semibold text-secondary"
273-
:class="item.class"
272+
class="flex items-center justify-between gap-3 border-0 px-4 py-2.5 text-sm font-semibold text-secondary"
273+
:class="[
274+
item.class,
275+
item.dividerBefore && index > 0
276+
? 'border-t border-solid border-surface-5'
277+
: undefined,
278+
]"
274279
>
275280
<span class="flex min-w-0 items-center gap-2">
276281
<component
@@ -398,6 +403,7 @@ export type DropdownFilterBarSectionHeader = {
398403
key?: string
399404
icon?: Component
400405
class?: string
406+
dividerBefore?: boolean
401407
}
402408
403409
export type DropdownFilterBarItem = DropdownFilterBarOption | DropdownFilterBarSectionHeader

‎packages/ui/src/components/base/StyledInput.vue‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<textarea
2222
v-if="multiline"
2323
:id="id"
24+
v-bind="inputAttrs"
2425
ref="inputRef"
2526
:value="model"
2627
:placeholder="placeholder"
@@ -50,6 +51,7 @@
5051
<input
5152
v-else
5253
:id="id"
54+
v-bind="inputAttrs"
5355
ref="inputRef"
5456
:type="type"
5557
:value="model"
@@ -149,6 +151,7 @@ const props = withDefaults(
149151
resize?: 'none' | 'vertical' | 'both'
150152
inputClass?: string
151153
wrapperClass?: string
154+
inputAttrs?: Record<string, string | number | boolean | undefined>
152155
}>(),
153156
{
154157
type: 'text',

‎packages/ui/src/components/base/Table.vue‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<template>
2-
<div class="overflow-hidden rounded-2xl border border-solid border-surface-5">
2+
<div class="overflow-hidden rounded-2xl border border-solid border-surface-4">
33
<div
44
v-if="hasHeaderSlot"
5-
class="border-solid border-0 border-b border-surface-5 bg-surface-3 p-4"
5+
class="border-solid border-0 border-b border-surface-4 bg-surface-3 p-4"
66
>
77
<slot name="header" />
88
</div>
99
<div class="overflow-x-auto overflow-y-hidden">
1010
<table
11-
class="w-full table-fixed border-separate border-spacing-0 border-surface-5"
11+
class="w-full table-fixed border-separate border-spacing-0 border-surface-4"
1212
:style="tableMinWidth ? { minWidth: tableMinWidth } : undefined"
1313
>
1414
<colgroup>
@@ -68,7 +68,7 @@
6868
tag="tbody"
6969
>
7070
<tr v-if="data.length === 0" key="empty" class="bg-surface-2">
71-
<td :colspan="columnSpan" class="border-solid border-0 border-t border-surface-5 p-0">
71+
<td :colspan="columnSpan" class="border-solid border-0 border-t border-surface-4 p-0">
7272
<slot name="empty-state">
7373
<div class="text-secondary flex h-64 items-center justify-center">
7474
No data available.
@@ -84,7 +84,7 @@
8484
>
8585
<td
8686
v-if="showSelection"
87-
class="w-12 border-solid border-0 border-t border-surface-5 focus:outline-none"
87+
class="w-12 border-solid border-0 border-t border-surface-4 focus:outline-none"
8888
>
8989
<Checkbox
9090
:model-value="isSelected(row)"
@@ -95,7 +95,7 @@
9595
<td
9696
v-for="column in columns"
9797
:key="column.key"
98-
class="text-secondary h-14 overflow-hidden first:pl-4 last:pr-4 border-solid border-0 border-t border-surface-5"
98+
class="text-secondary h-14 overflow-hidden first:pl-4 last:pr-4 border-solid border-0 border-t border-surface-4"
9999
:class="`text-${column.align ?? 'left'}`"
100100
>
101101
<slot
@@ -113,7 +113,7 @@
113113
</TransitionGroup>
114114
<tbody v-else :ref="setListContainer">
115115
<tr v-if="data.length === 0" class="bg-surface-2">
116-
<td :colspan="columnSpan" class="border-solid border-0 border-t border-surface-5 p-0">
116+
<td :colspan="columnSpan" class="border-solid border-0 border-t border-surface-4 p-0">
117117
<slot name="empty-state">
118118
<div class="text-secondary flex h-64 items-center justify-center">
119119
No data available.
@@ -136,7 +136,7 @@
136136
>
137137
<td
138138
v-if="showSelection"
139-
class="w-12 border-solid border-0 border-t border-surface-5 focus:outline-none"
139+
class="w-12 border-solid border-0 border-t border-surface-4 focus:outline-none"
140140
>
141141
<Checkbox
142142
:model-value="isSelected(row)"
@@ -147,7 +147,7 @@
147147
<td
148148
v-for="column in columns"
149149
:key="column.key"
150-
class="text-secondary h-14 overflow-hidden first:pl-4 last:pr-4 border-solid border-0 border-t border-surface-5"
150+
class="text-secondary h-14 overflow-hidden first:pl-4 last:pr-4 border-solid border-0 border-t border-surface-4"
151151
:class="`text-${column.align ?? 'left'}`"
152152
>
153153
<slot

‎packages/ui/src/components/servers/access/AccessTable.vue‎

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
>
1212
<template #cell-user="{ row: member }">
1313
<AutoLink
14-
:to="userProfilePath(member.user.username)"
14+
:to="getUserProfileLink(member.user.username)"
15+
:target="userProfileTarget(member.user.username)"
1516
class="inline-flex max-w-full min-w-0 items-center gap-2"
16-
:class="userProfilePath(member.user.username) ? 'text-primary hover:underline' : ''"
17+
:class="getUserProfileLink(member.user.username) ? 'text-primary hover:underline' : ''"
1718
>
1819
<Avatar
1920
:src="member.user.avatarUrl"
@@ -61,7 +62,7 @@
6162
<template #cell-joined="{ row: member }">
6263
<span
6364
v-if="member.pending"
64-
class="inline-flex h-7 items-center rounded-full border border-surface-5 border-solid bg-surface-4 px-2.5 py-1 text-sm font-semibold text-secondary"
65+
class="inline-flex h-7 items-center rounded-full border border-surface-4 border-solid bg-surface-4 px-2.5 py-1 text-sm font-semibold text-secondary"
6566
>
6667
{{ formatMessage(messages.pendingLabel) }}
6768
</span>
@@ -102,7 +103,7 @@
102103

103104
<div
104105
v-if="members.length > 0"
105-
class="overflow-hidden rounded-2xl border border-solid border-surface-5 sm:hidden"
106+
class="overflow-hidden rounded-2xl border border-solid border-surface-4 sm:hidden"
106107
>
107108
<div
108109
class="grid min-h-14 grid-cols-[minmax(0,1.35fr)_7.75rem_minmax(6rem,0.8fr)_4rem] bg-surface-3"
@@ -147,15 +148,16 @@
147148
<div
148149
v-for="(member, index) in sortedMembers"
149150
:key="member.id"
150-
class="grid min-h-16 grid-cols-[minmax(0,1.35fr)_7.75rem_minmax(6rem,0.8fr)_4rem] items-center border-0 border-t border-solid border-surface-5"
151+
class="grid min-h-16 grid-cols-[minmax(0,1.35fr)_7.75rem_minmax(6rem,0.8fr)_4rem] items-center border-0 border-t border-solid border-surface-4"
151152
:class="index % 2 === 0 ? 'bg-surface-2' : 'bg-surface-1.5'"
152153
>
153154
<div class="flex min-w-0 items-center pl-4">
154155
<AutoLink
155156
v-tooltip="member.user.username"
156-
:to="userProfilePath(member.user.username)"
157+
:to="getUserProfileLink(member.user.username)"
158+
:target="userProfileTarget(member.user.username)"
157159
class="inline-flex min-w-0 items-center gap-2"
158-
:class="userProfilePath(member.user.username) ? 'text-primary hover:underline' : ''"
160+
:class="getUserProfileLink(member.user.username) ? 'text-primary hover:underline' : ''"
159161
>
160162
<Avatar
161163
:src="member.user.avatarUrl"
@@ -207,7 +209,7 @@
207209
<div class="min-w-0 py-3 pr-2 text-right text-secondary">
208210
<span
209211
v-if="member.pending"
210-
class="inline-flex h-7 max-w-full items-center rounded-full border border-surface-5 border-solid bg-surface-4 px-2.5 py-1 text-sm font-semibold text-secondary"
212+
class="inline-flex h-7 max-w-full items-center rounded-full border border-surface-4 border-solid bg-surface-4 px-2.5 py-1 text-sm font-semibold text-secondary"
211213
>
212214
{{ formatMessage(messages.pendingLabel) }}
213215
</span>
@@ -248,7 +250,7 @@
248250
</div>
249251
</div>
250252

251-
<div v-else class="overflow-hidden rounded-2xl border border-solid border-surface-5">
253+
<div v-else class="overflow-hidden rounded-2xl border border-solid border-surface-4">
252254
<div
253255
class="grid min-h-14 grid-cols-[3.75rem_7.25rem_minmax(0,1fr)_2.75rem] bg-surface-3 sm:h-14 sm:grid-cols-[32%_28%_28%_12%]"
254256
>
@@ -266,7 +268,7 @@
266268
</div>
267269
</div>
268270
<div
269-
class="border-0 border-t border-solid border-surface-5 bg-surface-2 px-4 py-8 text-center text-secondary"
271+
class="border-0 border-t border-solid border-surface-4 bg-surface-2 px-4 py-8 text-center text-secondary"
270272
>
271273
{{ formatMessage(messages.emptyState) }}
272274
</div>
@@ -293,14 +295,20 @@ import ButtonStyled from '../../base/ButtonStyled.vue'
293295
import Combobox, { type ComboboxOption } from '../../base/Combobox.vue'
294296
import Table, { type SortDirection, type TableColumn } from '../../base/Table.vue'
295297
import TeleportOverflowMenu from '../../base/TeleportOverflowMenu.vue'
296-
import type { ServerAccessMember, ServerAccessRole, ServerAccessRoleOption } from './types'
298+
import type {
299+
ServerAccessMember,
300+
ServerAccessRole,
301+
ServerAccessRoleOption,
302+
ServerAccessUserProfileLink,
303+
} from './types'
297304
298305
const props = withDefaults(
299306
defineProps<{
300307
members: ServerAccessMember[]
301308
roles: ServerAccessRoleOption[]
302309
canManageUsers?: boolean
303310
permissionDeniedMessage?: string
311+
userProfileLink?: (username: string) => ServerAccessUserProfileLink
304312
}>(),
305313
{
306314
canManageUsers: true,
@@ -353,11 +361,11 @@ const messages = defineMessages({
353361
},
354362
cancelInvite: {
355363
id: 'servers.access-table.action.cancel-invite',
356-
defaultMessage: 'Cancel invite',
364+
defaultMessage: 'Revoke invite',
357365
},
358366
removeUser: {
359367
id: 'servers.access-table.action.remove-user',
360-
defaultMessage: 'Remove user',
368+
defaultMessage: 'Revoke access',
361369
},
362370
emptyState: {
363371
id: 'servers.access-table.empty',
@@ -533,9 +541,14 @@ function roleTriggerClass(role: ServerAccessRole): string {
533541
return roleClasses(role)
534542
}
535543
536-
function userProfilePath(username: string): string | undefined {
544+
function getUserProfileLink(username: string): ServerAccessUserProfileLink {
537545
if (!username || username.includes('@')) return undefined
538-
return `/user/${encodeURIComponent(username)}`
546+
return props.userProfileLink?.(username) ?? `/user/${encodeURIComponent(username)}`
547+
}
548+
549+
function userProfileTarget(username: string): string | undefined {
550+
const link = getUserProfileLink(username)
551+
return typeof link === 'string' && link.startsWith('http') ? '_blank' : undefined
539552
}
540553
541554
function resendInviteCooldownSeconds(member: ServerAccessMember): number {

0 commit comments

Comments
 (0)