Skip to content

Commit c623967

Browse files
refactor(profile): migrate edit profile modal to SolidJS
1 parent 94b22a7 commit c623967

8 files changed

Lines changed: 285 additions & 381 deletions

File tree

frontend/src/html/popups.html

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -355,78 +355,3 @@
355355
<div class="suggestions"></div>
356356
</div>
357357
</dialog>
358-
359-
<dialog id="editProfileModal" class="modalWrapper hidden">
360-
<form class="modal">
361-
<div class="title">Edit Profile</div>
362-
<div>
363-
<label>name</label>
364-
<div>
365-
To update your name, go to Account Settings > Account > Update account
366-
name
367-
</div>
368-
</div>
369-
<div>
370-
<label>avatar</label>
371-
<div>
372-
To update your avatar make sure your Discord account is linked, then go
373-
to Account Settings > Account > Discord Integration and click "Update
374-
Avatar"
375-
</div>
376-
</div>
377-
<div>
378-
<label>bio</label>
379-
<textarea class="bio" autocomplete="off" maxlength="250"></textarea>
380-
</div>
381-
<div>
382-
<label>keyboard</label>
383-
<textarea class="keyboard" autocomplete="off" maxlength="75"></textarea>
384-
</div>
385-
<div>
386-
<label>github</label>
387-
<div class="socialURL">
388-
<p>https://github.com/</p>
389-
<input
390-
class="github"
391-
type="text"
392-
value=""
393-
placeholder="username"
394-
maxlength="39"
395-
/>
396-
</div>
397-
</div>
398-
<div>
399-
<label>twitter</label>
400-
<div class="socialURL">
401-
<p>https://x.com/</p>
402-
<input
403-
class="twitter"
404-
type="text"
405-
value=""
406-
placeholder="username"
407-
maxlength="20"
408-
/>
409-
</div>
410-
</div>
411-
<div>
412-
<label>website</label>
413-
<input class="website" type="text" value="" maxlength="200" />
414-
</div>
415-
<div>
416-
<label>badge</label>
417-
<div class="badgeSelectionContainer"></div>
418-
</div>
419-
<div>
420-
<label>public activity</label>
421-
<label class="checkbox">
422-
<input
423-
class="editProfileShowActivityOnPublicProfile"
424-
type="checkbox"
425-
checked
426-
/>
427-
<span>Include test activity graph on your public profile.</span>
428-
</label>
429-
</div>
430-
<button class="edit-profile-submit" type="submit">save</button>
431-
</form>
432-
</dialog>

frontend/src/styles/popups.scss

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -667,63 +667,4 @@ body.darkMode {
667667
}
668668
}
669669
}
670-
}
671-
672-
#editProfileModal {
673-
.modal {
674-
max-width: 600px;
675-
max-height: 100%;
676-
label {
677-
color: var(--sub-color);
678-
margin-bottom: 0.25em;
679-
display: block;
680-
}
681-
input:not([type="checkbox"]) {
682-
width: 100%;
683-
}
684-
input[type="checkbox"] {
685-
vertical-align: text-bottom;
686-
}
687-
textarea {
688-
resize: vertical;
689-
width: 100%;
690-
padding: 10px;
691-
line-height: 1.2rem;
692-
min-height: 5rem;
693-
max-height: 10rem;
694-
}
695-
696-
.socialURL {
697-
display: flex;
698-
}
699-
700-
.socialURL > p {
701-
margin-block: 0.5rem;
702-
margin-inline-end: 0.5rem;
703-
}
704-
705-
.badgeSelectionContainer {
706-
display: flex;
707-
flex-wrap: wrap;
708-
}
709-
710-
.badgeSelectionItem {
711-
width: max-content;
712-
opacity: 25%;
713-
cursor: pointer;
714-
margin-right: 0.5rem;
715-
margin-bottom: 0.5rem;
716-
padding: 0;
717-
border-radius: calc(var(--roundness) / 2);
718-
}
719-
720-
.badgeSelectionItem.selected,
721-
.badgeSelectionItem:hover {
722-
opacity: 100%;
723-
}
724-
725-
span {
726-
color: var(--text-color);
727-
}
728-
}
729-
}
670+
}

frontend/src/ts/components/pages/profile/UserDetails.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ import { createEffect, createSignal, For, JSXElement, Show } from "solid-js";
1616

1717
import { Snapshot } from "../../../constants/default-snapshot";
1818
import { addFriend, isFriend } from "../../../db";
19-
import * as EditProfileModal from "../../../modals/edit-profile";
2019
import * as UserReportModal from "../../../modals/user-report";
2120
import { bp } from "../../../states/breakpoints";
2221
import { getUserId, isAuthenticated } from "../../../states/core";
22+
import { showModal } from "../../../states/modals";
2323
import {
2424
showNoticeNotification,
2525
showErrorNotification,
@@ -36,6 +36,7 @@ import { Button } from "../../common/Button";
3636
import { DiscordAvatar } from "../../common/DiscordAvatar";
3737
import { UserBadge } from "../../common/UserBadge";
3838
import { UserFlags } from "../../common/UserFlags";
39+
import { EditProfile } from "../../popups/EditProfile";
3940

4041
type Variant = "basic" | "hasSocials" | "hasBioOrKeyboard" | "full";
4142

@@ -98,6 +99,9 @@ export function UserDetails(props: {
9899
isAccountPage={props.isAccountPage}
99100
/>
100101
</div>
102+
<Show when={props.isAccountPage === true}>
103+
<EditProfile />
104+
</Show>
101105
</div>
102106
);
103107
}
@@ -177,7 +181,7 @@ function ActionButtons(props: {
177181
showNoticeNotification("Banned users cannot edit their profile");
178182
return;
179183
}
180-
EditProfileModal.show();
184+
showModal("EditProfile");
181185
}}
182186
/>
183187
<Button

0 commit comments

Comments
 (0)