mirror of https://github.com/hykilpikonna/AquaDX
[O] Show edit profile button only if it's me
parent
58ca71baaa
commit
49da7aafd0
|
@ -1,15 +1,16 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { CHARTJS_OPT, coverNotFound, pfpNotFound, registerChart, renderCal, title, tooltip } from "../libs/ui";
|
import { CHARTJS_OPT, coverNotFound, pfpNotFound, registerChart, renderCal, title, tooltip } from "../libs/ui";
|
||||||
import type { GenericGamePlaylog, GenericGameSummary, MusicMeta, TrendEntry } from "../libs/generalTypes";
|
import type { GenericGamePlaylog, GenericGameSummary, MusicMeta, TrendEntry, UserMe } from "../libs/generalTypes";
|
||||||
import {DATA_HOST} from "../libs/config";
|
import {DATA_HOST} from "../libs/config";
|
||||||
import 'cal-heatmap/cal-heatmap.css';
|
import 'cal-heatmap/cal-heatmap.css';
|
||||||
import { Line } from 'svelte-chartjs';
|
import { Line } from 'svelte-chartjs';
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import 'chartjs-adapter-moment';
|
import 'chartjs-adapter-moment';
|
||||||
import { DATA, GAME } from "../libs/sdk";
|
import { DATA, GAME, USER } from "../libs/sdk";
|
||||||
import { type GameName, getMult } from "../libs/scoring";
|
import { type GameName, getMult } from "../libs/scoring";
|
||||||
import StatusOverlays from "../components/StatusOverlays.svelte";
|
import StatusOverlays from "../components/StatusOverlays.svelte";
|
||||||
import Icon from "@iconify/svelte";
|
import Icon from "@iconify/svelte";
|
||||||
|
import EditProfile from "./User/EditProfile.svelte";
|
||||||
|
|
||||||
registerChart()
|
registerChart()
|
||||||
|
|
||||||
|
@ -18,6 +19,7 @@
|
||||||
let calElement: HTMLElement
|
let calElement: HTMLElement
|
||||||
let error: string;
|
let error: string;
|
||||||
let editingProfile = false
|
let editingProfile = false
|
||||||
|
let me: UserMe
|
||||||
title(`User ${username}`)
|
title(`User ${username}`)
|
||||||
|
|
||||||
interface MusicAndPlay extends MusicMeta, GenericGamePlaylog {}
|
interface MusicAndPlay extends MusicMeta, GenericGamePlaylog {}
|
||||||
|
@ -28,6 +30,8 @@
|
||||||
recent: MusicAndPlay[]
|
recent: MusicAndPlay[]
|
||||||
} | null
|
} | null
|
||||||
|
|
||||||
|
USER.isLoggedIn() && USER.me().then(u => me = u)
|
||||||
|
|
||||||
Promise.all([
|
Promise.all([
|
||||||
GAME.userSummary(username, game),
|
GAME.userSummary(username, game),
|
||||||
GAME.trend(username, game),
|
GAME.trend(username, game),
|
||||||
|
@ -57,11 +61,13 @@
|
||||||
<img src={`${DATA_HOST}/d/${game}/assetbundle/icon/${d.user.iconId.toString().padStart(6, "0")}.png`} alt="" class="pfp" on:error={pfpNotFound}>
|
<img src={`${DATA_HOST}/d/${game}/assetbundle/icon/${d.user.iconId.toString().padStart(6, "0")}.png`} alt="" class="pfp" on:error={pfpNotFound}>
|
||||||
<div class="name-box">
|
<div class="name-box">
|
||||||
<h2>{d.user.name}</h2>
|
<h2>{d.user.name}</h2>
|
||||||
<span class="setting-icon clickable" on:click={() => editingProfile = true}
|
{#if me && me.username === username}
|
||||||
on:keydown={e => e.key === "Enter" && (editingProfile = true)} tabindex="0" role="button"
|
<span class="setting-icon clickable" on:click={() => editingProfile = true}
|
||||||
use:tooltip={"Settings"}>
|
on:keydown={e => e.key === "Enter" && (editingProfile = true)} tabindex="0" role="button"
|
||||||
|
use:tooltip={"Settings"}>
|
||||||
<Icon icon="eos-icons:rotating-gear"/>
|
<Icon icon="eos-icons:rotating-gear"/>
|
||||||
</span>
|
</span>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<nav>
|
<nav>
|
||||||
{#each Object.entries(games) as [g, name]}
|
{#each Object.entries(games) as [g, name]}
|
||||||
|
|
Loading…
Reference in New Issue