Skip to content

Commit 1c721a0

Browse files
committed
feat: Add provider hint to profile
1 parent 04593b1 commit 1c721a0

File tree

3 files changed

+87
-41
lines changed

3 files changed

+87
-41
lines changed

packages/frontendmu-nuxt/components/auth/MyProfile.vue

Lines changed: 76 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -100,32 +100,49 @@ function updateProfile() {
100100

101101
<form class="md:col-span-2 pb-16">
102102
<div class="grid grid-cols-1 gap-x-6 gap-y-8 sm:max-w-xl sm:grid-cols-6">
103-
<div v-if="avatarUrl" class="col-span-full flex items-center gap-x-8">
103+
<div
104+
v-if="avatarUrl"
105+
class="col-span-full flex items-center gap-x-8"
106+
>
104107
<img
105-
:src="avatarUrl || ''" alt=""
108+
:src="avatarUrl || ''"
109+
alt=""
106110
class="h-28 w-28 flex-none rounded-lg bg-gray-800 object-cover"
107111
>
108112
</div>
109113

110114
<div class="col-span-full">
111-
<label for="email" class="block text-lg font-medium leading-6">Email address</label>
115+
<label
116+
for="email"
117+
class="block text-lg font-medium leading-6"
118+
>Email address</label>
112119
<div class="mt-2">
113120
<input
114-
id="email" v-model="userDetails.email" disabled name="email" type="email"
121+
id="email"
122+
v-model="userDetails.email"
123+
disabled
124+
name="email"
125+
type="email"
115126
autocomplete="email"
116127
class="block w-full pl-2 rounded-md border-0 bg-white/5 py-1.5 shadow-sm ring-1 ring-inset dark:ring-white/10 focus:ring-2 focus:ring-inset focus:ring-indigo-500 sm:text-lg sm:leading-6"
117128
>
118129
</div>
119130
</div>
120131

121132
<div class="col-span-full">
122-
<label for="fullname" class="block text-lg font-medium leading-6">Full name</label>
133+
<label
134+
for="fullname"
135+
class="block text-lg font-medium leading-6"
136+
>Full name</label>
123137
<div class="mt-2">
124138
<div
125139
class="flex rounded-md bg-white/5 ring-1 ring-inset dark:ring-white/10 focus-within:ring-2 focus-within:ring-inset focus-within:ring-indigo-500"
126140
>
127141
<input
128-
id="fullname" v-model="userDetails.full_name" type="text" name="fullname"
142+
id="fullname"
143+
v-model="userDetails.full_name"
144+
type="text"
145+
name="fullname"
129146
autocomplete="username"
130147
class="flex-1 border-0 bg-transparent py-1.5 pl-2 focus:ring-0 sm:text-lg sm:leading-6"
131148
>
@@ -134,29 +151,41 @@ function updateProfile() {
134151
</div>
135152

136153
<div class="col-span-full">
137-
<label for="github_username" class="block text-lg font-medium leading-6">GitHub
154+
<label
155+
for="github_username"
156+
class="block text-lg font-medium leading-6"
157+
>GitHub
138158
Username</label>
139159
<div class="mt-2">
140160
<div
141161
class="flex rounded-md bg-white/5 ring-1 ring-inset dark:ring-white/10 focus-within:ring-2 focus-within:ring-inset focus-within:ring-indigo-500"
142162
>
143163
<input
144-
id="github_username" v-model="userDetails.github_username" type="text"
145-
name="github_username" autocomplete="username"
164+
id="github_username"
165+
v-model="userDetails.github_username"
166+
type="text"
167+
name="github_username"
168+
autocomplete="username"
146169
class="flex-1 border-0 bg-transparent py-1.5 pl-2 focus:ring-0 sm:text-lg sm:leading-6"
147170
>
148171
</div>
149172
</div>
150173
</div>
151174

152175
<div class="col-span-full">
153-
<label for="phone" class="block text-lg font-medium leading-6">Phone</label>
176+
<label
177+
for="phone"
178+
class="block text-lg font-medium leading-6"
179+
>Phone</label>
154180
<div class="mt-2">
155181
<div
156182
class="flex rounded-md bg-white/5 ring-1 ring-inset dark:ring-white/10 focus-within:ring-2 focus-within:ring-inset focus-within:ring-indigo-500"
157183
>
158184
<input
159-
id="phone" v-model="userDetails.phone" name="phone" autocomplete="phone"
185+
id="phone"
186+
v-model="userDetails.phone"
187+
name="phone"
188+
autocomplete="phone"
160189
class="flex-1 border-0 bg-transparent py-1.5 pl-2 focus:ring-0 sm:text-lg sm:leading-6"
161190
placeholder="57654321"
162191
>
@@ -180,10 +209,16 @@ function updateProfile() {
180209

181210
<div>
182211
<div class="flex flex-col">
183-
<template v-for="event in rawUser?.Events" :key="(event.Events_id as DirectusEvent).id">
212+
<template
213+
v-for="event in rawUser?.Events"
214+
:key="(event.Events_id as DirectusEvent).id"
215+
>
184216
<template v-if="(typeof event.Events_id !== 'string')">
185217
<div>
186-
<NuxtLink :href="`/meetup/${event.Events_id.id}`" class="text-lg font-medium">
218+
<NuxtLink
219+
:href="`/meetup/${event.Events_id.id}`"
220+
class="text-lg font-medium"
221+
>
187222
{{
188223
event.Events_id.title }}
189224
</NuxtLink>
@@ -207,7 +242,10 @@ function updateProfile() {
207242
Transport
208243
</RadioGroupLabel>
209244
<div class="flex gap-4 flex-wrap">
210-
<FormRadio :disabled="isLoading" :options="transportOptions" />
245+
<FormRadio
246+
:disabled="isLoading"
247+
:options="transportOptions"
248+
/>
211249
</div>
212250
</RadioGroup>
213251
</FormLabel>
@@ -218,7 +256,10 @@ function updateProfile() {
218256
Meal
219257
</RadioGroupLabel>
220258
<div class="flex gap-4 flex-wrap">
221-
<FormRadio :disabled="isLoading" :options="foodOptions" />
259+
<FormRadio
260+
:disabled="isLoading"
261+
:options="foodOptions"
262+
/>
222263
</div>
223264
</RadioGroup>
224265
</FormLabel>
@@ -229,7 +270,10 @@ function updateProfile() {
229270
Profession
230271
</RadioGroupLabel>
231272
<div class="flex gap-4 flex-wrap">
232-
<FormRadio :disabled="isLoading" :options="professionOptions" />
273+
<FormRadio
274+
:disabled="isLoading"
275+
:options="professionOptions"
276+
/>
233277
</div>
234278
</RadioGroup>
235279
</FormLabel>
@@ -251,36 +295,26 @@ function updateProfile() {
251295
<div class="grid grid-cols-1 gap-x-6 gap-y-8 sm:max-w-xl sm:grid-cols-6">
252296
<div class="col-span-full">
253297
<div class="mt-2">
254-
<svg xmlns="http://www.w3.org/2000/svg" width="272" height="92">
255-
<path
256-
fill="#EA4335"
257-
d="M115.75 47.18c0 12.77-9.99 22.18-22.25 22.18s-22.25-9.41-22.25-22.18C71.25 34.32 81.24 25 93.5 25s22.25 9.32 22.25 22.18zm-9.74 0c0-7.98-5.79-13.44-12.51-13.44S80.99 39.2 80.99 47.18c0 7.9 5.79 13.44 12.51 13.44s12.51-5.55 12.51-13.44z"
258-
/>
259-
<path
260-
fill="#FBBC05"
261-
d="M163.75 47.18c0 12.77-9.99 22.18-22.25 22.18s-22.25-9.41-22.25-22.18c0-12.85 9.99-22.18 22.25-22.18s22.25 9.32 22.25 22.18zm-9.74 0c0-7.98-5.79-13.44-12.51-13.44s-12.51 5.46-12.51 13.44c0 7.9 5.79 13.44 12.51 13.44s12.51-5.55 12.51-13.44z"
298+
<div v-if="user?.provider === 'default'">
299+
<Icon
300+
class="w-[100px] h-[100px]"
301+
name="fluent:animal-rabbit-24-regular"
262302
/>
263-
<path
264-
fill="#4285F4"
265-
d="M209.75 26.34v39.82c0 16.38-9.66 23.07-21.08 23.07-10.75 0-17.22-7.19-19.66-13.07l8.48-3.53c1.51 3.61 5.21 7.87 11.17 7.87 7.31 0 11.84-4.51 11.84-13v-3.19h-.34c-2.18 2.69-6.38 5.04-11.68 5.04-11.09 0-21.25-9.66-21.25-22.09 0-12.52 10.16-22.26 21.25-22.26 5.29 0 9.49 2.35 11.68 4.96h.34v-3.61h9.25zm-8.56 20.92c0-7.81-5.21-13.52-11.84-13.52-6.72 0-12.35 5.71-12.35 13.52 0 7.73 5.63 13.36 12.35 13.36 6.63 0 11.84-5.63 11.84-13.36z"
266-
/>
267-
<path fill="#34A853" d="M225 3v65h-9.5V3h9.5z" />
268-
<path
269-
fill="#EA4335"
270-
d="m262.02 54.48 7.56 5.04c-2.44 3.61-8.32 9.83-18.48 9.83-12.6 0-22.01-9.74-22.01-22.18 0-13.19 9.49-22.18 20.92-22.18 11.51 0 17.14 9.16 18.98 14.11l1.01 2.52-29.65 12.28c2.27 4.45 5.8 6.72 10.75 6.72 4.96 0 8.4-2.44 10.92-6.14zm-23.27-7.98 19.82-8.23c-1.09-2.77-4.37-4.7-8.23-4.7-4.95 0-11.84 4.37-11.59 12.93z"
271-
/>
272-
<path
273-
fill="#4285F4"
274-
d="M35.29 41.41V32H67c.31 1.64.47 3.58.47 5.68 0 7.06-1.93 15.79-8.15 22.01-6.05 6.3-13.78 9.66-24.02 9.66C16.32 69.35.36 53.89.36 34.91.36 15.93 16.32.47 35.3.47c10.5 0 17.98 4.12 23.6 9.49l-6.64 6.64c-4.03-3.78-9.49-6.72-16.97-6.72-13.86 0-24.7 11.17-24.7 25.03 0 13.86 10.84 25.03 24.7 25.03 8.99 0 14.11-3.61 17.39-6.89 2.66-2.66 4.41-6.46 5.1-11.65l-22.49.01z"
303+
</div>
304+
<div v-else>
305+
<Icon
306+
:name="`logos:${user?.provider}`"
307+
class="w-[200px] h-[100px]"
275308
/>
276-
</svg>
309+
</div>
277310
</div>
278311
</div>
279312
</div>
280313

281314
<div class="mt-8 flex">
282315
<button
283-
type="submit" class="rounded-md bg-red-500 px-3 py-2 text-sm font-semibold shadow-sm hover:bg-red-400 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-500"
316+
type="submit"
317+
class="rounded-md bg-red-500 px-3 py-2 text-sm font-semibold shadow-sm hover:bg-red-400 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-500"
284318
@click.prevent="logout()"
285319
>
286320
Log me out
@@ -295,7 +329,10 @@ function updateProfile() {
295329
You are not logged in.
296330
</div>
297331

298-
<BaseButton href="/login" color="primary">
332+
<BaseButton
333+
href="/login"
334+
color="primary"
335+
>
299336
Login to RSVP
300337
</BaseButton>
301338
</div>

packages/frontendmu-nuxt/components/auth/RsvpAttendeeList.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,18 @@ onMounted(async () => {
9696
>
9797
<div class="flex flex-col gap-4 justify-center">
9898
<div class="relative flex flex-col items-center">
99-
<template v-if="attendee.profile_picture">
99+
<template v-if="attendee.provider === 'github'">
100+
<img
101+
:src="`https://github.com/${attendee.external_identifier}.png`"
102+
alt=""
103+
class="rounded-full mx-auto w-28 h-28 aspect-square"
104+
>
105+
</template>
106+
<template v-else-if="attendee.profile_picture">
100107
<img
101108
:src="base64Url(attendee.profile_picture)"
102109
alt=""
103-
class="rounded-full mx-auto w-full max-w-[130px] aspect-square"
110+
class="rounded-full mx-auto w-28 h-28 aspect-square"
104111
>
105112
</template>
106113
<template v-else>

packages/frontendmu-nuxt/utils/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ export interface Attendee {
216216
name: string
217217
profile_picture: string
218218
verified: boolean
219+
provider: string
220+
external_identifier: string
219221
}
220222

221223
export interface RSVPResponse {

0 commit comments

Comments
 (0)