feat: add global & server leveling, quests, achievements, guilds land-claiming, social & toggleable configs
This commit is contained in:
1 parent
4b79f69c20
commit
b4cef85b1f
40 files changed
+10261
-27
No files matched your search
@@ -0,0 +1,850 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import {
|
||||
Shield, Map, Users, MessageSquare, Plus, Crown, UserCheck, Trash2,
|
||||
Pin, LoaderCircle, RefreshCw, ChevronDown, Check, AlertCircle, Sparkles, Send
|
||||
} from '@lucide/svelte';
|
||||
import Avatar from '../components/Avatar.svelte';
|
||||
import ChunkMap from '../components/ChunkMap.svelte';
|
||||
import Modal from '../components/Modal.svelte';
|
||||
import { app, instances, selectedInstance, toast } from '../lib/store.svelte';
|
||||
import { invoke } from '../lib/tauri';
|
||||
import type { Guild, GuildMember, GuildPost } from '../lib/types';
|
||||
|
||||
let selectedInstId = $state<string>(selectedInstance()?.id || (instances()[0]?.id ?? ''));
|
||||
let myGuild = $state<Guild | null>(null);
|
||||
let allGuilds = $state<Guild[]>([]);
|
||||
let members = $state<GuildMember[]>([]);
|
||||
let posts = $state<GuildPost[]>([]);
|
||||
let activeTab = $state<'territory' | 'members' | 'feed'>('territory');
|
||||
let loading = $state(false);
|
||||
|
||||
// Create Guild Modal
|
||||
let createModalOpen = $state(false);
|
||||
let newGuildName = $state('');
|
||||
let newGuildTag = $state('');
|
||||
let newGuildDesc = $state('');
|
||||
let newGuildIcon = $state('');
|
||||
let newGuildBanner = $state('');
|
||||
let creating = $state(false);
|
||||
|
||||
// New Post Form
|
||||
let postTitle = $state('');
|
||||
let postContent = $state('');
|
||||
let postPinned = $state(false);
|
||||
let posting = $state(false);
|
||||
|
||||
const currentInstance = $derived(
|
||||
instances().find((i) => i.id === selectedInstId) ?? instances()[0] ?? null
|
||||
);
|
||||
|
||||
async function loadInstanceGuildData() {
|
||||
if (!selectedInstId) return;
|
||||
loading = true;
|
||||
try {
|
||||
const [mine, list] = await Promise.all([
|
||||
invoke<Guild | null>('get_my_guild', { instanceId: selectedInstId }).catch(() => null),
|
||||
invoke<Guild[]>('get_guilds', { instanceId: selectedInstId }).catch(() => [])
|
||||
]);
|
||||
myGuild = mine;
|
||||
allGuilds = list;
|
||||
|
||||
if (mine) {
|
||||
const [mList, pList] = await Promise.all([
|
||||
invoke<GuildMember[]>('get_guild_members', { guildId: mine.id }).catch(() => []),
|
||||
invoke<GuildPost[]>('get_guild_posts', { guildId: mine.id }).catch(() => [])
|
||||
]);
|
||||
members = mList;
|
||||
posts = pList;
|
||||
} else {
|
||||
members = [];
|
||||
posts = [];
|
||||
}
|
||||
} catch (e: any) {
|
||||
toast(e?.message ?? 'Failed to load guild data', 'error');
|
||||
} finally {
|
||||
loading = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function handleCreateGuild() {
|
||||
if (!newGuildName.trim() || !newGuildTag.trim()) {
|
||||
toast('Please enter both guild name and tag', 'error');
|
||||
return;
|
||||
}
|
||||
creating = true;
|
||||
try {
|
||||
const guild = await invoke<Guild>('create_guild', {
|
||||
instanceId: selectedInstId,
|
||||
name: newGuildName.trim(),
|
||||
tag: newGuildTag.trim().toUpperCase(),
|
||||
description: newGuildDesc.trim(),
|
||||
iconUrl: newGuildIcon.trim() || null,
|
||||
bannerUrl: newGuildBanner.trim() || null
|
||||
});
|
||||
toast(`Guild [${guild.tag}] ${guild.name} founded!`, 'ok');
|
||||
createModalOpen = false;
|
||||
newGuildName = '';
|
||||
newGuildTag = '';
|
||||
newGuildDesc = '';
|
||||
newGuildIcon = '';
|
||||
newGuildBanner = '';
|
||||
await loadInstanceGuildData();
|
||||
} catch (e: any) {
|
||||
toast(e?.message ?? 'Failed to create guild', 'error');
|
||||
} finally {
|
||||
creating = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function handleCreatePost() {
|
||||
if (!myGuild || !postTitle.trim() || !postContent.trim()) {
|
||||
toast('Please provide a title and announcement content', 'error');
|
||||
return;
|
||||
}
|
||||
posting = true;
|
||||
try {
|
||||
const post = await invoke<GuildPost>('create_guild_post', {
|
||||
guildId: myGuild.id,
|
||||
title: postTitle.trim(),
|
||||
content: postContent.trim(),
|
||||
pinned: postPinned
|
||||
});
|
||||
posts = [post, ...posts];
|
||||
postTitle = '';
|
||||
postContent = '';
|
||||
postPinned = false;
|
||||
toast('Announcement posted to guild wall', 'ok');
|
||||
} catch (e: any) {
|
||||
toast(e?.message ?? 'Failed to create post', 'error');
|
||||
} finally {
|
||||
posting = false;
|
||||
}
|
||||
}
|
||||
|
||||
$effect(() => {
|
||||
if (selectedInstId) {
|
||||
loadInstanceGuildData();
|
||||
}
|
||||
});
|
||||
|
||||
onMount(() => {
|
||||
if (selectedInstance()?.id) {
|
||||
selectedInstId = selectedInstance()!.id;
|
||||
}
|
||||
loadInstanceGuildData();
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="guilds-page">
|
||||
<!-- Page Header & Instance Picker -->
|
||||
<div class="page-header">
|
||||
<div class="title-wrap">
|
||||
<h1><Shield class="guild-icon" size={26} /> Guilds & Territories</h1>
|
||||
<p class="lead">Form factions, claim land chunks protected from griefing, and collaborate with your party.</p>
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
<div class="instance-select-wrap">
|
||||
<label for="instance-select" class="tiny muted uppercase">Instance</label>
|
||||
<select
|
||||
id="instance-select"
|
||||
class="inst-select"
|
||||
bind:value={selectedInstId}
|
||||
>
|
||||
{#each instances() as inst}
|
||||
<option value={inst.id}>{inst.name}</option>
|
||||
{/each}
|
||||
</select>
|
||||
</div>
|
||||
<button class="ghost icon" onclick={loadInstanceGuildData} title="Refresh" aria-label="Refresh">
|
||||
<RefreshCw size={17} class={loading ? 'spin' : ''} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if loading && !myGuild && !allGuilds.length}
|
||||
<div class="center-state"><LoaderCircle class="spin" size={32} /></div>
|
||||
{:else if myGuild}
|
||||
<!-- User is in a Guild -->
|
||||
<div class="guild-hub">
|
||||
<!-- Guild Banner & Meta Header -->
|
||||
<div
|
||||
class="guild-hero glass"
|
||||
style:background-image={myGuild.banner_url ? `linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.85)), url(${myGuild.banner_url})` : undefined}
|
||||
>
|
||||
<div class="guild-hero-content">
|
||||
<div class="guild-tag-badge">
|
||||
<span class="tag-text">[{myGuild.tag}]</span>
|
||||
</div>
|
||||
<div class="guild-info">
|
||||
<div class="guild-title-line">
|
||||
<h2>{myGuild.name}</h2>
|
||||
<span class="badge member-badge"><Users size={12} /> {myGuild.member_count} / {myGuild.max_members} Members</span>
|
||||
<span class="badge claim-badge"><Shield size={12} /> {myGuild.claims_count} Claims</span>
|
||||
</div>
|
||||
{#if myGuild.description}
|
||||
<p class="guild-desc">{myGuild.description}</p>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Segmented Navigation Tabs -->
|
||||
<div class="guild-tabs-row">
|
||||
<div class="tabs-segmented">
|
||||
<button class:active={activeTab === 'territory'} onclick={() => (activeTab = 'territory')}>
|
||||
<Map size={15} /> Territory & Land Claims
|
||||
</button>
|
||||
<button class:active={activeTab === 'members'} onclick={() => (activeTab = 'members')}>
|
||||
<Users size={15} /> Roster ({members.length})
|
||||
</button>
|
||||
<button class:active={activeTab === 'feed'} onclick={() => (activeTab = 'feed')}>
|
||||
<MessageSquare size={15} /> Guild Feed ({posts.length})
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tab Content -->
|
||||
{#if activeTab === 'territory'}
|
||||
<div class="territory-tab">
|
||||
<div class="protection-callout glass">
|
||||
<Shield size={18} class="callout-icon" />
|
||||
<div class="callout-text">
|
||||
<strong>Grief Protection Relay Active</strong>
|
||||
<p class="tiny muted">
|
||||
Chunks claimed by your guild are synchronized with the SCOPENET mod/plugin on the server. Non-members cannot break or place blocks within your claims.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ChunkMap
|
||||
instanceId={selectedInstId}
|
||||
myGuildId={myGuild.id}
|
||||
myGuildTag={myGuild.tag}
|
||||
onclaim={() => { if (myGuild) myGuild.claims_count += 1; }}
|
||||
onunclaim={() => { if (myGuild) myGuild.claims_count = Math.max(0, myGuild.claims_count - 1); }}
|
||||
/>
|
||||
</div>
|
||||
{:else if activeTab === 'members'}
|
||||
<div class="members-tab">
|
||||
<div class="members-grid">
|
||||
{#each members as m (m.user_uuid)}
|
||||
<div
|
||||
class="member-card glass"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
onclick={() => (app.viewProfileUuid = m.user_uuid)}
|
||||
onkeydown={(e) => e.key === 'Enter' && (app.viewProfileUuid = m.user_uuid)}
|
||||
>
|
||||
<div class="member-avatar-wrap">
|
||||
<Avatar uuid={m.user_uuid} name={m.username} size={2.5} />
|
||||
{#if m.is_online}
|
||||
<span class="online-indicator" title="Online"></span>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="member-details">
|
||||
<div class="member-name-row">
|
||||
<span class="member-name">{m.username}</span>
|
||||
{#if m.role === 'leader'}
|
||||
<span class="badge leader-badge"><Crown size={11} /> Leader</span>
|
||||
{:else if m.role === 'officer'}
|
||||
<span class="badge officer-badge"><UserCheck size={11} /> Officer</span>
|
||||
{:else}
|
||||
<span class="badge member-role-badge">Member</span>
|
||||
{/if}
|
||||
</div>
|
||||
<span class="tiny muted">Joined {new Date(m.joined_at).toLocaleDateString()}</span>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{:else if activeTab === 'feed'}
|
||||
<div class="feed-tab">
|
||||
<!-- Post Announcement Form -->
|
||||
<div class="post-creator glass">
|
||||
<span class="creator-title">Post Guild Announcement</span>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Announcement Title"
|
||||
bind:value={postTitle}
|
||||
class="post-title-input"
|
||||
/>
|
||||
<textarea
|
||||
placeholder="Share news, raid plans, or updates with your guild..."
|
||||
bind:value={postContent}
|
||||
rows="3"
|
||||
class="post-textarea"
|
||||
></textarea>
|
||||
<div class="post-creator-footer">
|
||||
<label class="pin-checkbox tiny">
|
||||
<input type="checkbox" bind:checked={postPinned} />
|
||||
<span>Pin to top</span>
|
||||
</label>
|
||||
<button
|
||||
class="primary sm"
|
||||
onclick={handleCreatePost}
|
||||
disabled={posting}
|
||||
>
|
||||
{#if posting}<LoaderCircle size={13} class="spin" />{:else}<Send size={13} />{/if}
|
||||
Publish
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Posts Feed -->
|
||||
<div class="posts-list">
|
||||
{#if posts.length === 0}
|
||||
<div class="empty-state glass">
|
||||
<MessageSquare size={32} class="muted" />
|
||||
<p>No guild announcements posted yet.</p>
|
||||
</div>
|
||||
{:else}
|
||||
{#each posts as p (p.id)}
|
||||
<div class="post-card glass" class:pinned={p.pinned}>
|
||||
<div class="post-header">
|
||||
<div class="author-meta">
|
||||
<Avatar uuid={p.author_uuid} name={p.author_name} size={1.8} />
|
||||
<div class="author-info">
|
||||
<span class="author-name">{p.author_name}</span>
|
||||
<span class="post-date tiny muted">{new Date(p.created_at).toLocaleString()}</span>
|
||||
</div>
|
||||
</div>
|
||||
{#if p.pinned}
|
||||
<span class="badge pinned-badge"><Pin size={11} /> Pinned</span>
|
||||
{/if}
|
||||
</div>
|
||||
<h4 class="post-headline">{p.title}</h4>
|
||||
<p class="post-text">{p.content}</p>
|
||||
</div>
|
||||
{/each}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{:else}
|
||||
<!-- User is NOT in a Guild on this instance -->
|
||||
<div class="no-guild-container">
|
||||
<div class="hero-prompt glass">
|
||||
<div class="prompt-icon-box">
|
||||
<Shield size={38} class="guild-icon" />
|
||||
</div>
|
||||
<div class="prompt-text">
|
||||
<h2>No Guild on {currentInstance?.name || 'this Instance'}</h2>
|
||||
<p class="lead">
|
||||
Guilds are tied to instances. Start your own guild to claim land chunks, invite members, and build a faction base, or browse existing factions below.
|
||||
</p>
|
||||
<button class="primary create-guild-btn" onclick={() => (createModalOpen = true)}>
|
||||
<Plus size={16} /> Create a Guild
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Browse Guilds Section -->
|
||||
<div class="browse-section">
|
||||
<div class="browse-header">
|
||||
<h3>Active Guilds ({allGuilds.length})</h3>
|
||||
</div>
|
||||
{#if allGuilds.length === 0}
|
||||
<div class="empty-state glass">
|
||||
<p>No guilds have been created on this instance yet. Be the first to establish territory!</p>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="guilds-directory-grid">
|
||||
{#each allGuilds as g (g.id)}
|
||||
<div class="guild-dir-card glass">
|
||||
<div class="dir-top">
|
||||
<div class="dir-tag">[{g.tag}]</div>
|
||||
<div class="dir-meta">
|
||||
<h4>{g.name}</h4>
|
||||
<span class="tiny muted">{g.member_count} / {g.max_members} Members • {g.claims_count} Chunks Claimed</span>
|
||||
</div>
|
||||
</div>
|
||||
{#if g.description}
|
||||
<p class="dir-desc">{g.description}</p>
|
||||
{/if}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<!-- Create Guild Modal -->
|
||||
<Modal bind:open={createModalOpen} title="Found a New Guild" width={28}>
|
||||
<div class="modal-form">
|
||||
<label>
|
||||
<span class="field-label">Guild Name</span>
|
||||
<input type="text" placeholder="e.g. Iron Fortress" bind:value={newGuildName} maxlength="32" />
|
||||
</label>
|
||||
<label>
|
||||
<span class="field-label">Guild Tag (3 - 5 characters)</span>
|
||||
<input type="text" placeholder="e.g. IRON" bind:value={newGuildTag} maxlength="5" class="tag-input" />
|
||||
<span class="tiny muted">Appears in brackets on claimed chunks and chat tags.</span>
|
||||
</label>
|
||||
<label>
|
||||
<span class="field-label">Description / Moto</span>
|
||||
<textarea placeholder="Describe your guild's playstyle, goals, or rules..." bind:value={newGuildDesc} rows="3"></textarea>
|
||||
</label>
|
||||
<label>
|
||||
<span class="field-label">Banner Image URL (Optional)</span>
|
||||
<input type="url" placeholder="https://example.com/banner.png" bind:value={newGuildBanner} />
|
||||
</label>
|
||||
</div>
|
||||
{#snippet footer()}
|
||||
<button class="ghost" onclick={() => (createModalOpen = false)}>Cancel</button>
|
||||
<button class="primary" onclick={handleCreateGuild} disabled={creating}>
|
||||
{#if creating}<LoaderCircle size={14} class="spin" />{:else}<Sparkles size={14} />{/if}
|
||||
Found Guild
|
||||
</button>
|
||||
{/snippet}
|
||||
</Modal>
|
||||
|
||||
<style>
|
||||
.guilds-page {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow-y: auto;
|
||||
padding: 1.6rem 2.2rem 2.5rem;
|
||||
gap: 1.2rem;
|
||||
}
|
||||
.page-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-end;
|
||||
border-bottom: 1px solid var(--line);
|
||||
padding-bottom: 1rem;
|
||||
flex-wrap: wrap;
|
||||
gap: 1rem;
|
||||
}
|
||||
.title-wrap h1 {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.6rem;
|
||||
}
|
||||
:global(.guild-icon) {
|
||||
color: var(--accent);
|
||||
}
|
||||
.lead {
|
||||
color: var(--muted);
|
||||
font-size: 0.88rem;
|
||||
margin-top: 0.2rem;
|
||||
}
|
||||
.header-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.8rem;
|
||||
}
|
||||
.instance-select-wrap {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.2rem;
|
||||
}
|
||||
.inst-select {
|
||||
background: color-mix(in srgb, var(--bg) 70%, transparent);
|
||||
border: 1px solid var(--line);
|
||||
color: var(--text);
|
||||
padding: 0.35rem 0.75rem;
|
||||
border-radius: var(--radius-sm);
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
.guild-hub {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
.guild-hero {
|
||||
display: flex;
|
||||
padding: 1.5rem 1.8rem;
|
||||
border-radius: var(--radius);
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
border: 1px solid var(--line);
|
||||
}
|
||||
.guild-hero-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1.2rem;
|
||||
}
|
||||
.guild-tag-badge {
|
||||
padding: 0.6rem 1rem;
|
||||
border-radius: var(--radius-sm);
|
||||
background: color-mix(in srgb, var(--accent) 25%, transparent);
|
||||
border: 2px solid var(--accent);
|
||||
box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 30%, transparent);
|
||||
}
|
||||
.tag-text {
|
||||
font-size: 1.4rem;
|
||||
font-weight: 800;
|
||||
letter-spacing: 0.08em;
|
||||
color: var(--accent);
|
||||
}
|
||||
.guild-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
.guild-title-line {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.8rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.guild-title-line h2 {
|
||||
font-size: 1.4rem;
|
||||
font-weight: 750;
|
||||
}
|
||||
.guild-desc {
|
||||
font-size: 0.85rem;
|
||||
color: var(--muted);
|
||||
max-width: 42rem;
|
||||
}
|
||||
.guild-tabs-row {
|
||||
display: flex;
|
||||
}
|
||||
.tabs-segmented {
|
||||
display: flex;
|
||||
background: color-mix(in srgb, var(--surface) 80%, transparent);
|
||||
padding: 0.25rem;
|
||||
border-radius: var(--radius-sm);
|
||||
border: 1px solid var(--line);
|
||||
gap: 0.2rem;
|
||||
}
|
||||
.tabs-segmented button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
background: transparent;
|
||||
border: none;
|
||||
padding: 0.45rem 1rem;
|
||||
font-size: 0.85rem;
|
||||
font-weight: 560;
|
||||
color: var(--muted);
|
||||
border-radius: calc(var(--radius-sm) - 2px);
|
||||
transition: all 0.15s;
|
||||
}
|
||||
.tabs-segmented button.active {
|
||||
background: color-mix(in srgb, var(--text) 10%, transparent);
|
||||
color: var(--text);
|
||||
}
|
||||
.territory-tab {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.9rem;
|
||||
}
|
||||
.protection-callout {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.8rem;
|
||||
padding: 0.75rem 1rem;
|
||||
border-radius: var(--radius-sm);
|
||||
background: color-mix(in srgb, var(--success) 10%, transparent);
|
||||
border: 1px solid color-mix(in srgb, var(--success) 35%, transparent);
|
||||
}
|
||||
:global(.callout-icon) {
|
||||
color: var(--success);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.callout-text p {
|
||||
margin: 0;
|
||||
}
|
||||
.members-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
|
||||
gap: 0.9rem;
|
||||
}
|
||||
.member-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.8rem;
|
||||
padding: 0.8rem 1rem;
|
||||
border-radius: var(--radius-sm);
|
||||
border: 1px solid var(--line);
|
||||
background: var(--surface);
|
||||
cursor: pointer;
|
||||
transition: transform 0.12s, border-color 0.15s;
|
||||
}
|
||||
.member-card:hover {
|
||||
transform: translateY(-2px);
|
||||
border-color: var(--line-strong);
|
||||
}
|
||||
.member-avatar-wrap {
|
||||
position: relative;
|
||||
}
|
||||
.online-indicator {
|
||||
position: absolute;
|
||||
bottom: -1px;
|
||||
right: -1px;
|
||||
width: 9px;
|
||||
height: 9px;
|
||||
border-radius: 50%;
|
||||
background: var(--success);
|
||||
border: 2px solid var(--surface);
|
||||
}
|
||||
.member-details {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.2rem;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.member-name-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.3rem;
|
||||
}
|
||||
.member-name {
|
||||
font-weight: 650;
|
||||
font-size: 0.88rem;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.leader-badge {
|
||||
background: color-mix(in srgb, #f59e0b 20%, transparent);
|
||||
color: #f59e0b;
|
||||
}
|
||||
.officer-badge {
|
||||
background: color-mix(in srgb, var(--accent) 20%, transparent);
|
||||
color: var(--accent);
|
||||
}
|
||||
.member-role-badge {
|
||||
background: color-mix(in srgb, var(--text) 8%, transparent);
|
||||
color: var(--muted);
|
||||
}
|
||||
.feed-tab {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.2rem;
|
||||
}
|
||||
.post-creator {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.6rem;
|
||||
padding: 1rem 1.2rem;
|
||||
border-radius: var(--radius);
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--line);
|
||||
}
|
||||
.creator-title {
|
||||
font-size: 0.88rem;
|
||||
font-weight: 650;
|
||||
}
|
||||
.post-title-input {
|
||||
background: color-mix(in srgb, var(--bg) 60%, transparent);
|
||||
border: 1px solid var(--line);
|
||||
color: var(--text);
|
||||
padding: 0.4rem 0.75rem;
|
||||
border-radius: var(--radius-sm);
|
||||
font-size: 0.88rem;
|
||||
}
|
||||
.post-textarea {
|
||||
background: color-mix(in srgb, var(--bg) 60%, transparent);
|
||||
border: 1px solid var(--line);
|
||||
color: var(--text);
|
||||
padding: 0.5rem 0.75rem;
|
||||
border-radius: var(--radius-sm);
|
||||
font-size: 0.85rem;
|
||||
resize: vertical;
|
||||
}
|
||||
.post-creator-footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.pin-checkbox {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
color: var(--muted);
|
||||
cursor: pointer;
|
||||
}
|
||||
.posts-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.9rem;
|
||||
}
|
||||
.post-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.6rem;
|
||||
padding: 1.1rem 1.3rem;
|
||||
border-radius: var(--radius);
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--line);
|
||||
}
|
||||
.post-card.pinned {
|
||||
border-color: color-mix(in srgb, #f59e0b 40%, transparent);
|
||||
background: linear-gradient(135deg, color-mix(in srgb, #f59e0b 6%, var(--surface)) 0%, var(--surface) 100%);
|
||||
}
|
||||
.post-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.author-meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.6rem;
|
||||
}
|
||||
.author-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.author-name {
|
||||
font-size: 0.84rem;
|
||||
font-weight: 650;
|
||||
}
|
||||
.pinned-badge {
|
||||
background: color-mix(in srgb, #f59e0b 20%, transparent);
|
||||
color: #f59e0b;
|
||||
}
|
||||
.post-headline {
|
||||
font-size: 1rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
.post-text {
|
||||
font-size: 0.85rem;
|
||||
color: color-mix(in srgb, var(--text) 85%, transparent);
|
||||
line-height: 1.4;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
/* No Guild View */
|
||||
.no-guild-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.5rem;
|
||||
}
|
||||
.hero-prompt {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1.8rem;
|
||||
padding: 2rem;
|
||||
border-radius: var(--radius);
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--line);
|
||||
}
|
||||
.prompt-icon-box {
|
||||
width: 4.5rem;
|
||||
height: 4.5rem;
|
||||
border-radius: var(--radius);
|
||||
background: color-mix(in srgb, var(--accent) 15%, transparent);
|
||||
display: grid;
|
||||
place-items: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.prompt-text {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.4rem;
|
||||
}
|
||||
.prompt-text h2 {
|
||||
font-size: 1.3rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
.create-guild-btn {
|
||||
align-self: flex-start;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
.browse-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.9rem;
|
||||
}
|
||||
.browse-header h3 {
|
||||
font-size: 1.1rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
.guilds-directory-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
|
||||
gap: 1rem;
|
||||
}
|
||||
.guild-dir-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.6rem;
|
||||
padding: 1.1rem;
|
||||
border-radius: var(--radius);
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--line);
|
||||
}
|
||||
.dir-top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
.dir-tag {
|
||||
font-size: 1rem;
|
||||
font-weight: 800;
|
||||
color: var(--accent);
|
||||
padding: 0.3rem 0.6rem;
|
||||
border-radius: var(--radius-sm);
|
||||
background: color-mix(in srgb, var(--accent) 15%, transparent);
|
||||
}
|
||||
.dir-meta h4 {
|
||||
font-size: 0.95rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
.dir-desc {
|
||||
font-size: 0.82rem;
|
||||
color: var(--muted);
|
||||
line-height: 1.35;
|
||||
}
|
||||
.modal-form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.9rem;
|
||||
}
|
||||
.modal-form label {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.3rem;
|
||||
}
|
||||
.field-label {
|
||||
font-size: 0.82rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
.tag-input {
|
||||
text-transform: uppercase;
|
||||
font-family: monospace;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
.badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.3rem;
|
||||
font-size: 0.72rem;
|
||||
font-weight: 600;
|
||||
padding: 0.16rem 0.5rem;
|
||||
border-radius: 99rem;
|
||||
}
|
||||
.member-badge {
|
||||
background: color-mix(in srgb, var(--text) 8%, transparent);
|
||||
}
|
||||
.claim-badge {
|
||||
background: color-mix(in srgb, var(--success) 16%, transparent);
|
||||
color: var(--success);
|
||||
}
|
||||
.center-state, .empty-state {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.8rem;
|
||||
padding: 3rem 1.5rem;
|
||||
text-align: center;
|
||||
border-radius: var(--radius);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,723 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import {
|
||||
Target, Trophy, Clock, Sparkles, Check, Gift, Pickaxe, Swords, Hammer,
|
||||
Wheat, Users, Compass, RefreshCw, LoaderCircle, Flame, Star, Award, Shield
|
||||
} from '@lucide/svelte';
|
||||
import { invoke } from '../lib/tauri';
|
||||
import { toast } from '../lib/store.svelte';
|
||||
import type { UserLevelInfo, ServerLevelInfo, UserQuest, Achievement } from '../lib/types';
|
||||
|
||||
let activeTab = $state<'daily' | 'weekly' | 'achievements'>('daily');
|
||||
let selectedCategory = $state<string>('all');
|
||||
let loading = $state(false);
|
||||
let claimingQuestId = $state<string | null>(null);
|
||||
|
||||
let levelInfo = $state<UserLevelInfo | null>(null);
|
||||
let userQuests = $state<UserQuest[]>([]);
|
||||
let achievements = $state<Achievement[]>([]);
|
||||
|
||||
const categoryIcons: Record<string, any> = {
|
||||
mining: Pickaxe,
|
||||
combat: Swords,
|
||||
building: Hammer,
|
||||
farming: Wheat,
|
||||
social: Users,
|
||||
exploration: Compass
|
||||
};
|
||||
|
||||
async function loadData() {
|
||||
loading = true;
|
||||
try {
|
||||
const [lvl, quests, achs] = await Promise.all([
|
||||
invoke<UserLevelInfo>('get_my_level').catch(() => null),
|
||||
invoke<UserQuest[]>('get_my_quests').catch(() => []),
|
||||
invoke<Achievement[]>('get_my_achievements').catch(() => [])
|
||||
]);
|
||||
if (lvl) levelInfo = lvl;
|
||||
userQuests = quests;
|
||||
achievements = achs;
|
||||
} catch (e: any) {
|
||||
toast(e?.message ?? 'Failed to load quests data', 'error');
|
||||
} finally {
|
||||
loading = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function handleClaimQuest(questId: string) {
|
||||
claimingQuestId = questId;
|
||||
try {
|
||||
const updatedLevel = await invoke<UserLevelInfo>('claim_quest', { questId });
|
||||
levelInfo = updatedLevel;
|
||||
// Mark as claimed locally
|
||||
userQuests = userQuests.map((uq) => {
|
||||
if (uq.quest.id === questId) {
|
||||
return { ...uq, claimed: true };
|
||||
}
|
||||
return uq;
|
||||
});
|
||||
toast('Quest reward claimed! XP awarded to your Global Level.', 'ok');
|
||||
} catch (e: any) {
|
||||
toast(e?.message ?? 'Failed to claim reward', 'error');
|
||||
} finally {
|
||||
claimingQuestId = null;
|
||||
}
|
||||
}
|
||||
|
||||
const filteredQuests = $derived(
|
||||
userQuests.filter((uq) => {
|
||||
if (uq.quest.quest_type !== activeTab) return false;
|
||||
if (selectedCategory !== 'all' && uq.quest.category !== selectedCategory) return false;
|
||||
return true;
|
||||
})
|
||||
);
|
||||
|
||||
const completedCount = $derived(
|
||||
userQuests.filter((uq) => uq.quest.quest_type === activeTab && uq.completed).length
|
||||
);
|
||||
|
||||
const totalTabQuests = $derived(
|
||||
userQuests.filter((uq) => uq.quest.quest_type === activeTab).length
|
||||
);
|
||||
|
||||
const unlockedAchievementsCount = $derived(
|
||||
achievements.filter((a) => a.unlocked).length
|
||||
);
|
||||
|
||||
function getTimeUntilReset(type: 'daily' | 'weekly'): string {
|
||||
const now = new Date();
|
||||
if (type === 'daily') {
|
||||
const tomorrow = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate() + 1));
|
||||
const diffMs = tomorrow.getTime() - now.getTime();
|
||||
const hours = Math.floor(diffMs / (1000 * 60 * 60));
|
||||
const mins = Math.floor((diffMs % (1000 * 60 * 60)) / (1000 * 60));
|
||||
return `${hours}h ${mins}m`;
|
||||
} else {
|
||||
const day = now.getUTCDay();
|
||||
const daysUntilSunday = (7 - day) % 7 || 7;
|
||||
const nextSunday = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate() + daysUntilSunday));
|
||||
const diffMs = nextSunday.getTime() - now.getTime();
|
||||
const days = Math.floor(diffMs / (1000 * 60 * 60 * 24));
|
||||
const hours = Math.floor((diffMs % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
|
||||
return `${days}d ${hours}h`;
|
||||
}
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
loadData();
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="quests-page">
|
||||
<!-- Page Header -->
|
||||
<div class="page-header">
|
||||
<div class="title-wrap">
|
||||
<h1><Target class="target-icon" size={26} /> Quests & Progression</h1>
|
||||
<p class="lead">Complete daily and weekly quests across servers to level up your SCOPENET account.</p>
|
||||
</div>
|
||||
<button class="ghost icon" onclick={loadData} title="Refresh" aria-label="Refresh">
|
||||
<RefreshCw size={17} class={loading ? 'spin' : ''} />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Global Level Summary Hero Card -->
|
||||
{#if levelInfo}
|
||||
<div class="hero-level glass">
|
||||
<div class="level-badge-wrap">
|
||||
<div class="level-circle">
|
||||
<span class="lvl-label">LVL</span>
|
||||
<span class="lvl-number">{levelInfo.level}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="level-details">
|
||||
<div class="level-title-row">
|
||||
<div class="title-meta">
|
||||
<span class="level-name">SCOPENET Global Level</span>
|
||||
{#if levelInfo.title}
|
||||
<span class="badge title-badge"><Award size={12} /> {levelInfo.title}</span>
|
||||
{/if}
|
||||
</div>
|
||||
<span class="xp-ratio">
|
||||
<strong>{levelInfo.current_xp.toLocaleString()}</strong> / {levelInfo.next_level_xp.toLocaleString()} XP
|
||||
</span>
|
||||
</div>
|
||||
<div class="progress-bar-bg">
|
||||
<div class="progress-fill" style:width="{Math.min(100, Math.max(0, levelInfo.progress_pct))}%"></div>
|
||||
</div>
|
||||
<div class="level-footer">
|
||||
<span class="muted tiny">
|
||||
Playing on any SCOPENET server earns Global XP. Unlocks exclusive titles, badges, and cosmetic items.
|
||||
</span>
|
||||
{#if levelInfo.badges && levelInfo.badges.length > 0}
|
||||
<div class="badges-row">
|
||||
{#each levelInfo.badges as badge}
|
||||
<span class="badge icon-badge" title={badge}><Star size={11} /> {badge}</span>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Segmented Tabs Navigation -->
|
||||
<div class="nav-bar">
|
||||
<div class="tabs-segmented">
|
||||
<button class:active={activeTab === 'daily'} onclick={() => (activeTab = 'daily')}>
|
||||
<Clock size={15} /> Daily Quests
|
||||
</button>
|
||||
<button class:active={activeTab === 'weekly'} onclick={() => (activeTab = 'weekly')}>
|
||||
<Flame size={15} /> Weekly Quests
|
||||
</button>
|
||||
<button class:active={activeTab === 'achievements'} onclick={() => (activeTab = 'achievements')}>
|
||||
<Trophy size={15} /> Achievements ({unlockedAchievementsCount}/{achievements.length})
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{#if activeTab !== 'achievements'}
|
||||
<div class="reset-countdown muted tiny">
|
||||
<Clock size={13} />
|
||||
<span>Resets in: <strong>{getTimeUntilReset(activeTab)}</strong></span>
|
||||
<span class="divider">•</span>
|
||||
<span>Completed: <strong>{completedCount} / {totalTabQuests}</strong></span>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<!-- Content Section -->
|
||||
{#if loading && !userQuests.length}
|
||||
<div class="center-state"><LoaderCircle class="spin" size={32} /></div>
|
||||
{:else if activeTab === 'achievements'}
|
||||
<!-- Achievements List with Minecraft Frame Styling -->
|
||||
<div class="achievements-section">
|
||||
<div class="achievements-grid">
|
||||
{#each achievements as ach (ach.id)}
|
||||
<div class="achievement-card glass" class:unlocked={ach.unlocked} class:frame-task={ach.frame_type === 'task'} class:frame-goal={ach.frame_type === 'goal'} class:frame-challenge={ach.frame_type === 'challenge'}>
|
||||
<div class="achievement-icon-frame" style:background={ach.icon_bg || 'rgba(0,0,0,0.5)'} style:border-color={ach.icon_border || 'var(--line)'}>
|
||||
<span class="sprite-icon">{ach.icon_item || '💎'}</span>
|
||||
</div>
|
||||
<div class="achievement-body">
|
||||
<div class="achievement-header">
|
||||
<span class="ach-title">{ach.title}</span>
|
||||
<span class="badge frame-badge {ach.frame_type}">{ach.frame_type.toUpperCase()}</span>
|
||||
</div>
|
||||
<p class="ach-desc">{ach.description}</p>
|
||||
<div class="ach-footer">
|
||||
<span class="xp-tag">+{ach.xp_reward} XP</span>
|
||||
{#if ach.unlocked}
|
||||
<span class="badge unlocked-tag"><Check size={11} /> Unlocked</span>
|
||||
{:else}
|
||||
<span class="badge locked-tag">Locked</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<!-- Quests List -->
|
||||
<div class="quests-content">
|
||||
<!-- Category Filter Pills -->
|
||||
<div class="category-filters">
|
||||
{#each ['all', 'mining', 'combat', 'building', 'farming', 'social', 'exploration'] as cat}
|
||||
{@const CatIcon = categoryIcons[cat]}
|
||||
<button
|
||||
class="pill-btn"
|
||||
class:active={selectedCategory === cat}
|
||||
onclick={() => (selectedCategory = cat)}
|
||||
>
|
||||
{#if cat !== 'all' && CatIcon}
|
||||
<CatIcon size={13} />
|
||||
{/if}
|
||||
<span class="cap">{cat}</span>
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
{#if filteredQuests.length === 0}
|
||||
<div class="empty-state glass">
|
||||
<Target size={36} class="muted" />
|
||||
<p>No {activeTab} quests found in this category.</p>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="quests-grid">
|
||||
{#each filteredQuests as uq (uq.quest.id)}
|
||||
{@const pct = Math.min(100, Math.round((uq.current_count / Math.max(1, uq.quest.target_count)) * 100))}
|
||||
{@const IconComponent = categoryIcons[uq.quest.category] || Target}
|
||||
|
||||
<div class="quest-card glass" class:completed={uq.completed} class:claimed={uq.claimed}>
|
||||
<div class="quest-top">
|
||||
<div class="quest-icon-wrapper">
|
||||
<IconComponent size={20} class="cat-icon" />
|
||||
</div>
|
||||
<div class="quest-meta">
|
||||
<div class="quest-title-row">
|
||||
<span class="quest-title">{uq.quest.title}</span>
|
||||
<span class="badge cat-badge">{uq.quest.category}</span>
|
||||
</div>
|
||||
<p class="quest-desc">{uq.quest.description}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="quest-progress-wrap">
|
||||
<div class="progress-labels">
|
||||
<span class="progress-ratio">
|
||||
<strong>{uq.current_count}</strong> / {uq.quest.target_count} ({pct}%)
|
||||
</span>
|
||||
<span class="xp-badge">+{uq.quest.xp_reward} XP</span>
|
||||
</div>
|
||||
<div class="progress-bar-bg">
|
||||
<div class="progress-fill" style:width="{pct}%"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="quest-action-row">
|
||||
{#if uq.claimed}
|
||||
<span class="badge claimed-badge"><Check size={13} /> Reward Claimed</span>
|
||||
{:else if uq.completed}
|
||||
<button
|
||||
class="primary claim-btn"
|
||||
onclick={() => handleClaimQuest(uq.quest.id)}
|
||||
disabled={claimingQuestId === uq.quest.id}
|
||||
>
|
||||
{#if claimingQuestId === uq.quest.id}
|
||||
<LoaderCircle size={14} class="spin" />
|
||||
{:else}
|
||||
<Gift size={14} />
|
||||
{/if}
|
||||
Claim +{uq.quest.xp_reward} XP
|
||||
</button>
|
||||
{:else}
|
||||
<span class="badge in-progress-badge">In Progress</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.quests-page {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow-y: auto;
|
||||
padding: 1.6rem 2.2rem 2.5rem;
|
||||
gap: 1.2rem;
|
||||
}
|
||||
.page-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-end;
|
||||
border-bottom: 1px solid var(--line);
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
.title-wrap h1 {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.6rem;
|
||||
}
|
||||
:global(.target-icon) {
|
||||
color: var(--accent);
|
||||
}
|
||||
.lead {
|
||||
color: var(--muted);
|
||||
font-size: 0.88rem;
|
||||
margin-top: 0.2rem;
|
||||
}
|
||||
.hero-level {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1.5rem;
|
||||
padding: 1.2rem 1.6rem;
|
||||
border-radius: var(--radius);
|
||||
background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 15%, var(--surface)) 0%, var(--surface) 100%);
|
||||
border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
|
||||
}
|
||||
.level-badge-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.level-circle {
|
||||
width: 4.5rem;
|
||||
height: 4.5rem;
|
||||
border-radius: 50%;
|
||||
background: color-mix(in srgb, var(--accent) 25%, transparent);
|
||||
border: 3px solid var(--accent);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 40%, transparent);
|
||||
}
|
||||
.lvl-label {
|
||||
font-size: 0.65rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.08em;
|
||||
color: var(--accent);
|
||||
}
|
||||
.lvl-number {
|
||||
font-size: 1.6rem;
|
||||
font-weight: 800;
|
||||
line-height: 1;
|
||||
color: var(--text);
|
||||
}
|
||||
.level-details {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.45rem;
|
||||
}
|
||||
.level-title-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.title-meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.6rem;
|
||||
}
|
||||
.level-name {
|
||||
font-size: 1.15rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
.title-badge {
|
||||
background: color-mix(in srgb, #f59e0b 20%, transparent);
|
||||
color: #f59e0b;
|
||||
border: 1px solid color-mix(in srgb, #f59e0b 40%, transparent);
|
||||
}
|
||||
.xp-ratio {
|
||||
font-size: 0.88rem;
|
||||
color: var(--muted);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.xp-ratio strong {
|
||||
color: var(--text);
|
||||
}
|
||||
.progress-bar-bg {
|
||||
width: 100%;
|
||||
height: 0.55rem;
|
||||
border-radius: 99rem;
|
||||
background: color-mix(in srgb, var(--text) 10%, transparent);
|
||||
overflow: hidden;
|
||||
}
|
||||
.progress-fill {
|
||||
height: 100%;
|
||||
border-radius: 99rem;
|
||||
background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, white));
|
||||
transition: width 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
|
||||
}
|
||||
.level-footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.6rem;
|
||||
}
|
||||
.badges-row {
|
||||
display: flex;
|
||||
gap: 0.4rem;
|
||||
}
|
||||
.icon-badge {
|
||||
background: color-mix(in srgb, var(--text) 8%, transparent);
|
||||
font-size: 0.72rem;
|
||||
}
|
||||
.nav-bar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.8rem;
|
||||
}
|
||||
.tabs-segmented {
|
||||
display: flex;
|
||||
background: color-mix(in srgb, var(--surface) 80%, transparent);
|
||||
padding: 0.25rem;
|
||||
border-radius: var(--radius-sm);
|
||||
border: 1px solid var(--line);
|
||||
gap: 0.2rem;
|
||||
}
|
||||
.tabs-segmented button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
background: transparent;
|
||||
border: none;
|
||||
padding: 0.45rem 1rem;
|
||||
font-size: 0.85rem;
|
||||
font-weight: 560;
|
||||
color: var(--muted);
|
||||
border-radius: calc(var(--radius-sm) - 2px);
|
||||
transition: all 0.15s;
|
||||
}
|
||||
.tabs-segmented button.active {
|
||||
background: color-mix(in srgb, var(--text) 10%, transparent);
|
||||
color: var(--text);
|
||||
}
|
||||
.reset-countdown {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
}
|
||||
.divider {
|
||||
color: var(--line-strong);
|
||||
}
|
||||
.quests-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
.category-filters {
|
||||
display: flex;
|
||||
gap: 0.4rem;
|
||||
overflow-x: auto;
|
||||
padding-bottom: 0.2rem;
|
||||
}
|
||||
.pill-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
padding: 0.35rem 0.75rem;
|
||||
font-size: 0.8rem;
|
||||
font-weight: 560;
|
||||
border-radius: 99rem;
|
||||
background: color-mix(in srgb, var(--text) 6%, transparent);
|
||||
border: 1px solid transparent;
|
||||
color: var(--muted);
|
||||
transition: all 0.15s;
|
||||
}
|
||||
.pill-btn.active {
|
||||
background: color-mix(in srgb, var(--accent) 18%, transparent);
|
||||
border-color: color-mix(in srgb, var(--accent) 45%, transparent);
|
||||
color: var(--text);
|
||||
}
|
||||
.cap {
|
||||
text-transform: capitalize;
|
||||
}
|
||||
.quests-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
|
||||
gap: 1rem;
|
||||
}
|
||||
.quest-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
padding: 1.1rem 1.25rem;
|
||||
border-radius: var(--radius);
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--line);
|
||||
gap: 0.9rem;
|
||||
transition: transform 0.15s, border-color 0.15s;
|
||||
}
|
||||
.quest-card:hover {
|
||||
transform: translateY(-2px);
|
||||
border-color: var(--line-strong);
|
||||
}
|
||||
.quest-card.completed {
|
||||
border-color: color-mix(in srgb, var(--success) 45%, transparent);
|
||||
}
|
||||
.quest-card.claimed {
|
||||
opacity: 0.75;
|
||||
}
|
||||
.quest-top {
|
||||
display: flex;
|
||||
gap: 0.8rem;
|
||||
align-items: flex-start;
|
||||
}
|
||||
.quest-icon-wrapper {
|
||||
width: 2.2rem;
|
||||
height: 2.2rem;
|
||||
border-radius: var(--radius-sm);
|
||||
background: color-mix(in srgb, var(--accent) 14%, transparent);
|
||||
display: grid;
|
||||
place-items: center;
|
||||
flex-shrink: 0;
|
||||
color: var(--accent);
|
||||
}
|
||||
.quest-meta {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
.quest-title-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
gap: 0.4rem;
|
||||
}
|
||||
.quest-title {
|
||||
font-size: 0.92rem;
|
||||
font-weight: 650;
|
||||
line-height: 1.2;
|
||||
}
|
||||
.cat-badge {
|
||||
text-transform: uppercase;
|
||||
font-size: 0.65rem;
|
||||
letter-spacing: 0.05em;
|
||||
background: color-mix(in srgb, var(--text) 8%, transparent);
|
||||
color: var(--muted);
|
||||
}
|
||||
.quest-desc {
|
||||
font-size: 0.82rem;
|
||||
color: var(--muted);
|
||||
line-height: 1.35;
|
||||
}
|
||||
.quest-progress-wrap {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
.progress-labels {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
.xp-badge {
|
||||
color: var(--accent);
|
||||
font-weight: 700;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.quest-action-row {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
border-top: 1px solid color-mix(in srgb, var(--line) 40%, transparent);
|
||||
padding-top: 0.6rem;
|
||||
}
|
||||
.claim-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
font-size: 0.82rem;
|
||||
padding: 0.4rem 0.9rem;
|
||||
background: var(--success);
|
||||
border-color: var(--success);
|
||||
animation: pulse 2s infinite ease-in-out;
|
||||
}
|
||||
@keyframes pulse {
|
||||
0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 50%, transparent); }
|
||||
50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--success) 0%, transparent); }
|
||||
}
|
||||
.claimed-badge {
|
||||
background: color-mix(in srgb, var(--success) 15%, transparent);
|
||||
color: var(--success);
|
||||
}
|
||||
.in-progress-badge {
|
||||
background: color-mix(in srgb, var(--text) 8%, transparent);
|
||||
color: var(--muted);
|
||||
}
|
||||
.badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.3rem;
|
||||
font-size: 0.72rem;
|
||||
font-weight: 600;
|
||||
padding: 0.16rem 0.5rem;
|
||||
border-radius: 99rem;
|
||||
}
|
||||
.center-state, .empty-state {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.8rem;
|
||||
padding: 3rem 1.5rem;
|
||||
text-align: center;
|
||||
border-radius: var(--radius);
|
||||
}
|
||||
/* Achievements Section */
|
||||
.achievements-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
|
||||
gap: 1rem;
|
||||
}
|
||||
.achievement-card {
|
||||
display: flex;
|
||||
gap: 0.9rem;
|
||||
padding: 1.1rem;
|
||||
border-radius: var(--radius);
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--line);
|
||||
position: relative;
|
||||
opacity: 0.65;
|
||||
transition: opacity 0.15s, border-color 0.15s;
|
||||
}
|
||||
.achievement-card.unlocked {
|
||||
opacity: 1;
|
||||
border-color: color-mix(in srgb, var(--accent) 40%, transparent);
|
||||
}
|
||||
.achievement-card.frame-challenge.unlocked {
|
||||
border-color: #f59e0b88;
|
||||
background: linear-gradient(135deg, color-mix(in srgb, #f59e0b 8%, var(--surface)) 0%, var(--surface) 100%);
|
||||
}
|
||||
.achievement-icon-frame {
|
||||
width: 2.8rem;
|
||||
height: 2.8rem;
|
||||
border-radius: var(--radius-sm);
|
||||
border: 2px solid var(--line);
|
||||
display: grid;
|
||||
place-items: center;
|
||||
flex-shrink: 0;
|
||||
box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
.sprite-icon {
|
||||
font-size: 1.4rem;
|
||||
}
|
||||
.achievement-body {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.3rem;
|
||||
}
|
||||
.achievement-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.ach-title {
|
||||
font-size: 0.92rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
.frame-badge {
|
||||
font-size: 0.62rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
.frame-badge.task { background: #64748b33; color: #94a3b8; }
|
||||
.frame-badge.goal { background: #3b82f633; color: #60a5fa; }
|
||||
.frame-badge.challenge { background: #f59e0b33; color: #fbbf24; }
|
||||
.ach-desc {
|
||||
font-size: 0.8rem;
|
||||
color: var(--muted);
|
||||
line-height: 1.35;
|
||||
}
|
||||
.ach-footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-top: 0.2rem;
|
||||
}
|
||||
.xp-tag {
|
||||
font-size: 0.78rem;
|
||||
font-weight: 700;
|
||||
color: var(--accent);
|
||||
}
|
||||
.unlocked-tag {
|
||||
background: color-mix(in srgb, var(--success) 20%, transparent);
|
||||
color: var(--success);
|
||||
}
|
||||
.locked-tag {
|
||||
background: color-mix(in srgb, var(--text) 8%, transparent);
|
||||
color: var(--muted);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,913 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import {
|
||||
Users, UserPlus, MessageSquare, Gamepad2, Send, Check, X, Trash2,
|
||||
Clock, ExternalLink, LoaderCircle, RefreshCw, Circle, UserX, Sparkles
|
||||
} from '@lucide/svelte';
|
||||
import Avatar from '../components/Avatar.svelte';
|
||||
import Modal from '../components/Modal.svelte';
|
||||
import { activeAccount, app, instances, toast } from '../lib/store.svelte';
|
||||
import { invoke } from '../lib/tauri';
|
||||
import type { FriendInfo, DirectMessage, GameInvite } from '../lib/types';
|
||||
|
||||
let activeSection = $state<'friends' | 'messages' | 'invites'>('friends');
|
||||
let friendsFilter = $state<'all' | 'online' | 'pending'>('all');
|
||||
let loading = $state(false);
|
||||
|
||||
let friends = $state<FriendInfo[]>([]);
|
||||
let invites = $state<GameInvite[]>([]);
|
||||
let activeChatFriend = $state<FriendInfo | null>(null);
|
||||
let messages = $state<DirectMessage[]>([]);
|
||||
let messageInput = $state('');
|
||||
let sendingMessage = $state(false);
|
||||
|
||||
// Add Friend Modal / Input
|
||||
let addFriendUsername = $state('');
|
||||
let sendingFriendReq = $state(false);
|
||||
|
||||
// Send Game Invite Modal
|
||||
let inviteModalOpen = $state(false);
|
||||
let inviteTargetFriend = $state<FriendInfo | null>(null);
|
||||
let inviteInstanceId = $state(instances()[0]?.id ?? '');
|
||||
let sendingInvite = $state(false);
|
||||
|
||||
async function loadData() {
|
||||
loading = true;
|
||||
try {
|
||||
const [fList, iList] = await Promise.all([
|
||||
invoke<FriendInfo[]>('get_friends').catch(() => []),
|
||||
invoke<GameInvite[]>('get_game_invites').catch(() => [])
|
||||
]);
|
||||
friends = fList;
|
||||
invites = iList;
|
||||
} catch (e: any) {
|
||||
toast(e?.message ?? 'Failed to load social data', 'error');
|
||||
} finally {
|
||||
loading = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSendFriendRequest() {
|
||||
if (!addFriendUsername.trim()) return;
|
||||
sendingFriendReq = true;
|
||||
try {
|
||||
await invoke('send_friend_request', { friendUsername: addFriendUsername.trim() });
|
||||
toast(`Friend request sent to ${addFriendUsername.trim()}!`, 'ok');
|
||||
addFriendUsername = '';
|
||||
await loadData();
|
||||
} catch (e: any) {
|
||||
toast(e?.message ?? 'Failed to send friend request', 'error');
|
||||
} finally {
|
||||
sendingFriendReq = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function handleRespondRequest(friendUuid: string, accept: boolean) {
|
||||
try {
|
||||
await invoke('respond_friend_request', { friendUuid, accept });
|
||||
toast(accept ? 'Friend request accepted!' : 'Request declined.', 'ok');
|
||||
await loadData();
|
||||
} catch (e: any) {
|
||||
toast(e?.message ?? 'Action failed', 'error');
|
||||
}
|
||||
}
|
||||
|
||||
async function handleRemoveFriend(friendUuid: string) {
|
||||
try {
|
||||
await invoke('remove_friend', { friendUuid });
|
||||
friends = friends.filter((f) => f.uuid !== friendUuid);
|
||||
if (activeChatFriend?.uuid === friendUuid) {
|
||||
activeChatFriend = null;
|
||||
messages = [];
|
||||
}
|
||||
toast('Friend removed', 'ok');
|
||||
} catch (e: any) {
|
||||
toast(e?.message ?? 'Failed to remove friend', 'error');
|
||||
}
|
||||
}
|
||||
|
||||
async function selectChatFriend(friend: FriendInfo) {
|
||||
activeChatFriend = friend;
|
||||
activeSection = 'messages';
|
||||
try {
|
||||
messages = await invoke<DirectMessage[]>('get_direct_messages', {
|
||||
friendUuid: friend.uuid,
|
||||
limit: 50
|
||||
});
|
||||
} catch (e: any) {
|
||||
toast(e?.message ?? 'Failed to load messages', 'error');
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSendMessage() {
|
||||
if (!activeChatFriend || !messageInput.trim()) return;
|
||||
sendingMessage = true;
|
||||
const text = messageInput.trim();
|
||||
try {
|
||||
const msg = await invoke<DirectMessage>('send_direct_message', {
|
||||
toUuid: activeChatFriend.uuid,
|
||||
content: text
|
||||
});
|
||||
messages = [...messages, msg];
|
||||
messageInput = '';
|
||||
} catch (e: any) {
|
||||
toast(e?.message ?? 'Failed to send message', 'error');
|
||||
} finally {
|
||||
sendingMessage = false;
|
||||
}
|
||||
}
|
||||
|
||||
function openInviteModal(friend: FriendInfo) {
|
||||
inviteTargetFriend = friend;
|
||||
inviteModalOpen = true;
|
||||
}
|
||||
|
||||
async function handleSendInvite() {
|
||||
if (!inviteTargetFriend) return;
|
||||
sendingInvite = true;
|
||||
try {
|
||||
const inst = instances().find((i) => i.id === inviteInstanceId);
|
||||
await invoke('send_game_invite', {
|
||||
toUuid: inviteTargetFriend.uuid,
|
||||
instanceId: inviteInstanceId,
|
||||
serverAddress: inst?.server?.address ?? 'localhost',
|
||||
serverName: inst?.name ?? 'Minecraft Server'
|
||||
});
|
||||
toast(`Game invite sent to ${inviteTargetFriend.username}!`, 'ok');
|
||||
inviteModalOpen = false;
|
||||
} catch (e: any) {
|
||||
toast(e?.message ?? 'Failed to send game invite', 'error');
|
||||
} finally {
|
||||
sendingInvite = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function handleRespondInvite(inviteId: string, accept: boolean) {
|
||||
try {
|
||||
await invoke('respond_game_invite', { inviteId, accept });
|
||||
invites = invites.map((inv) =>
|
||||
inv.id === inviteId ? { ...inv, status: accept ? 'accepted' : 'declined' } : inv
|
||||
);
|
||||
toast(accept ? 'Game invite accepted!' : 'Invite declined.', 'ok');
|
||||
} catch (e: any) {
|
||||
toast(e?.message ?? 'Failed to respond to invite', 'error');
|
||||
}
|
||||
}
|
||||
|
||||
const acceptedFriends = $derived(friends.filter((f) => f.status === 'accepted'));
|
||||
const pendingReceived = $derived(friends.filter((f) => f.status === 'pending_received'));
|
||||
const pendingSent = $derived(friends.filter((f) => f.status === 'pending_sent'));
|
||||
|
||||
const displayedFriends = $derived(
|
||||
friends.filter((f) => {
|
||||
if (friendsFilter === 'online') return f.status === 'accepted' && f.is_online;
|
||||
if (friendsFilter === 'pending') return f.status !== 'accepted';
|
||||
return f.status === 'accepted';
|
||||
})
|
||||
);
|
||||
|
||||
onMount(() => {
|
||||
loadData();
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="social-page">
|
||||
<!-- Page Header -->
|
||||
<div class="page-header">
|
||||
<div class="title-wrap">
|
||||
<h1><Users class="users-icon" size={26} /> Friends & Social</h1>
|
||||
<p class="lead">Connect with friends, send direct messages, and team up with game invites.</p>
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
<button class="ghost icon" onclick={loadData} title="Refresh" aria-label="Refresh">
|
||||
<RefreshCw size={17} class={loading ? 'spin' : ''} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Social Navigation Tabs -->
|
||||
<div class="tabs-row">
|
||||
<div class="tabs-segmented">
|
||||
<button class:active={activeSection === 'friends'} onclick={() => (activeSection = 'friends')}>
|
||||
<Users size={15} /> Friends ({acceptedFriends.length})
|
||||
</button>
|
||||
<button class:active={activeSection === 'messages'} onclick={() => (activeSection = 'messages')}>
|
||||
<MessageSquare size={15} /> Direct Messages
|
||||
</button>
|
||||
<button class:active={activeSection === 'invites'} onclick={() => (activeSection = 'invites')}>
|
||||
<Gamepad2 size={15} /> Invites ({invites.filter((i) => i.status === 'pending').length})
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Content Sections -->
|
||||
{#if activeSection === 'friends'}
|
||||
<div class="friends-layout">
|
||||
<!-- Add Friend Bar -->
|
||||
<div class="add-friend-bar glass">
|
||||
<UserPlus size={18} class="muted" />
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Enter a player's username to add them..."
|
||||
bind:value={addFriendUsername}
|
||||
onkeydown={(e) => e.key === 'Enter' && handleSendFriendRequest()}
|
||||
class="add-friend-input"
|
||||
/>
|
||||
<button
|
||||
class="primary sm"
|
||||
onclick={handleSendFriendRequest}
|
||||
disabled={sendingFriendReq || !addFriendUsername.trim()}
|
||||
>
|
||||
{#if sendingFriendReq}<LoaderCircle size={14} class="spin" />{:else}Send Request{/if}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Filter Sub-tabs -->
|
||||
<div class="filter-pills">
|
||||
<button class="pill" class:active={friendsFilter === 'all'} onclick={() => (friendsFilter = 'all')}>
|
||||
All ({acceptedFriends.length})
|
||||
</button>
|
||||
<button class="pill" class:active={friendsFilter === 'online'} onclick={() => (friendsFilter = 'online')}>
|
||||
Online ({acceptedFriends.filter((f) => f.is_online).length})
|
||||
</button>
|
||||
<button class="pill" class:active={friendsFilter === 'pending'} onclick={() => (friendsFilter = 'pending')}>
|
||||
Pending ({pendingReceived.length + pendingSent.length})
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Pending Incoming Requests Alert -->
|
||||
{#if pendingReceived.length > 0 && friendsFilter !== 'pending'}
|
||||
<div class="pending-alert glass">
|
||||
<span class="tiny bold">You have {pendingReceived.length} pending friend request(s)</span>
|
||||
<button class="ghost sm" onclick={() => (friendsFilter = 'pending')}>Review</button>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Friends List -->
|
||||
{#if friendsFilter === 'pending'}
|
||||
<div class="pending-lists">
|
||||
{#if pendingReceived.length > 0}
|
||||
<h4 class="subheading">Incoming Requests ({pendingReceived.length})</h4>
|
||||
<div class="friends-grid">
|
||||
{#each pendingReceived as req (req.uuid)}
|
||||
<div class="friend-card glass">
|
||||
<div class="card-left" role="button" tabindex="0" onclick={() => (app.viewProfileUuid = req.uuid)} onkeydown={(e) => e.key === 'Enter' && (app.viewProfileUuid = req.uuid)}>
|
||||
<Avatar uuid={req.uuid} name={req.username} size={2.5} />
|
||||
<div class="name-block">
|
||||
<span class="user-title">{req.username}</span>
|
||||
<span class="tiny muted">Wants to be friends</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="req-actions">
|
||||
<button class="primary icon sm" onclick={() => handleRespondRequest(req.uuid, true)} title="Accept">
|
||||
<Check size={14} />
|
||||
</button>
|
||||
<button class="ghost icon sm" onclick={() => handleRespondRequest(req.uuid, false)} title="Decline">
|
||||
<X size={14} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if pendingSent.length > 0}
|
||||
<h4 class="subheading" style:margin-top="1rem">Outgoing Requests ({pendingSent.length})</h4>
|
||||
<div class="friends-grid">
|
||||
{#each pendingSent as req (req.uuid)}
|
||||
<div class="friend-card glass">
|
||||
<div class="card-left">
|
||||
<Avatar uuid={req.uuid} name={req.username} size={2.5} />
|
||||
<div class="name-block">
|
||||
<span class="user-title">{req.username}</span>
|
||||
<span class="tiny muted">Request pending...</span>
|
||||
</div>
|
||||
</div>
|
||||
<button class="ghost icon sm" onclick={() => handleRemoveFriend(req.uuid)} title="Cancel Request">
|
||||
<Trash2 size={14} />
|
||||
</button>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if pendingReceived.length === 0 && pendingSent.length === 0}
|
||||
<div class="empty-state glass">
|
||||
<p class="muted">No pending friend requests.</p>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{:else if displayedFriends.length === 0}
|
||||
<div class="empty-state glass">
|
||||
<Users size={32} class="muted" />
|
||||
<p class="muted">No friends found in this view. Add friends by typing their username above!</p>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="friends-grid">
|
||||
{#each displayedFriends as friend (friend.uuid)}
|
||||
<div class="friend-card glass">
|
||||
<div
|
||||
class="card-left"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
onclick={() => (app.viewProfileUuid = friend.uuid)}
|
||||
onkeydown={(e) => e.key === 'Enter' && (app.viewProfileUuid = friend.uuid)}
|
||||
title="View Profile"
|
||||
>
|
||||
<div class="avatar-holder">
|
||||
<Avatar uuid={friend.uuid} name={friend.username} size={2.6} />
|
||||
<span class="status-dot" class:online={friend.is_online}></span>
|
||||
</div>
|
||||
<div class="name-block">
|
||||
<span class="user-title">{friend.username}</span>
|
||||
{#if friend.is_online && friend.playing_on}
|
||||
<span class="tiny playing-on">Playing on {friend.playing_on}</span>
|
||||
{:else if friend.is_online}
|
||||
<span class="tiny online-label">Online in Launcher</span>
|
||||
{:else}
|
||||
<span class="tiny muted">Offline</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="friend-actions">
|
||||
<button class="ghost icon sm" onclick={() => selectChatFriend(friend)} title="Message">
|
||||
<MessageSquare size={15} />
|
||||
</button>
|
||||
<button class="ghost icon sm" onclick={() => openInviteModal(friend)} title="Invite to Game">
|
||||
<Gamepad2 size={15} />
|
||||
</button>
|
||||
<button class="ghost icon sm danger-hover" onclick={() => handleRemoveFriend(friend.uuid)} title="Remove Friend">
|
||||
<UserX size={15} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{:else if activeSection === 'messages'}
|
||||
<!-- Direct Messages Split View -->
|
||||
<div class="messages-split glass">
|
||||
<!-- Conversation Sidebar -->
|
||||
<div class="conv-sidebar">
|
||||
<span class="conv-head tiny uppercase muted">Conversations</span>
|
||||
<div class="conv-list">
|
||||
{#each acceptedFriends as friend (friend.uuid)}
|
||||
<button
|
||||
class="conv-item"
|
||||
class:active={activeChatFriend?.uuid === friend.uuid}
|
||||
onclick={() => selectChatFriend(friend)}
|
||||
>
|
||||
<div class="avatar-holder">
|
||||
<Avatar uuid={friend.uuid} name={friend.username} size={2} />
|
||||
<span class="status-dot" class:online={friend.is_online}></span>
|
||||
</div>
|
||||
<div class="conv-meta">
|
||||
<span class="conv-name">{friend.username}</span>
|
||||
{#if friend.playing_on}
|
||||
<span class="tiny muted">{friend.playing_on}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Chat Thread Main -->
|
||||
<div class="chat-thread">
|
||||
{#if activeChatFriend}
|
||||
<div class="thread-header">
|
||||
<div
|
||||
class="thread-user"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
onclick={() => (app.viewProfileUuid = activeChatFriend!.uuid)}
|
||||
onkeydown={(e) => e.key === 'Enter' && (app.viewProfileUuid = activeChatFriend!.uuid)}
|
||||
>
|
||||
<Avatar uuid={activeChatFriend.uuid} name={activeChatFriend.username} size={2.2} />
|
||||
<div>
|
||||
<strong>{activeChatFriend.username}</strong>
|
||||
<span class="tiny muted block">{activeChatFriend.is_online ? 'Active now' : 'Offline'}</span>
|
||||
</div>
|
||||
</div>
|
||||
<button class="primary sm" onclick={() => openInviteModal(activeChatFriend!)}>
|
||||
<Gamepad2 size={13} /> Invite
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="messages-scroll">
|
||||
{#if messages.length === 0}
|
||||
<div class="empty-state">
|
||||
<MessageSquare size={28} class="muted" />
|
||||
<p class="tiny muted">No messages yet with {activeChatFriend.username}. Say hello!</p>
|
||||
</div>
|
||||
{:else}
|
||||
{#each messages as msg (msg.id)}
|
||||
{@const isMine = msg.from_uuid === activeAccount()?.uuid}
|
||||
<div class="bubble-row" class:is-mine={isMine}>
|
||||
<div class="bubble" class:is-mine={isMine}>
|
||||
<p class="bubble-text">{msg.content}</p>
|
||||
<span class="bubble-time tiny">{new Date(msg.created_at).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}</span>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="message-composer">
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Type a message..."
|
||||
bind:value={messageInput}
|
||||
onkeydown={(e) => e.key === 'Enter' && handleSendMessage()}
|
||||
class="composer-input"
|
||||
/>
|
||||
<button
|
||||
class="primary icon"
|
||||
onclick={handleSendMessage}
|
||||
disabled={sendingMessage || !messageInput.trim()}
|
||||
aria-label="Send Message"
|
||||
>
|
||||
{#if sendingMessage}<LoaderCircle size={15} class="spin" />{:else}<Send size={15} />{/if}
|
||||
</button>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="center-state">
|
||||
<MessageSquare size={36} class="muted" />
|
||||
<p class="muted">Select a friend to start chatting</p>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{:else if activeSection === 'invites'}
|
||||
<!-- Game Invites View -->
|
||||
<div class="invites-view">
|
||||
{#if invites.length === 0}
|
||||
<div class="empty-state glass">
|
||||
<Gamepad2 size={36} class="muted" />
|
||||
<p class="muted">No game invites received. When friends invite you to join their server, they will appear here!</p>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="invites-grid">
|
||||
{#each invites as inv (inv.id)}
|
||||
<div class="invite-card glass">
|
||||
<div class="invite-top">
|
||||
<Avatar uuid={inv.from_uuid} name={inv.from_username} size={2.5} />
|
||||
<div class="invite-meta">
|
||||
<span class="inviter-name"><strong>{inv.from_username}</strong> invited you to play</span>
|
||||
<span class="server-title">{inv.server_name}</span>
|
||||
<span class="tiny muted server-addr">{inv.server_address}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="invite-footer">
|
||||
<span class="tiny muted">{new Date(inv.created_at).toLocaleDateString()}</span>
|
||||
{#if inv.status === 'pending'}
|
||||
<div class="invite-btns">
|
||||
<button class="primary sm" onclick={() => handleRespondInvite(inv.id, true)}>
|
||||
<Check size={13} /> Accept
|
||||
</button>
|
||||
<button class="ghost sm" onclick={() => handleRespondInvite(inv.id, false)}>
|
||||
Decline
|
||||
</button>
|
||||
</div>
|
||||
{:else}
|
||||
<span class="badge status-badge {inv.status}">{inv.status}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<!-- Send Game Invite Modal -->
|
||||
<Modal bind:open={inviteModalOpen} title="Invite {inviteTargetFriend?.username} to Play" width={24}>
|
||||
<div class="invite-modal-body">
|
||||
<p class="tiny muted">
|
||||
Choose which instance / server you want to invite {inviteTargetFriend?.username} to join:
|
||||
</p>
|
||||
<label>
|
||||
<span class="field-label">Instance</span>
|
||||
<select bind:value={inviteInstanceId} class="modal-select">
|
||||
{#each instances() as inst}
|
||||
<option value={inst.id}>{inst.name}</option>
|
||||
{/each}
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
{#snippet footer()}
|
||||
<button class="ghost" onclick={() => (inviteModalOpen = false)}>Cancel</button>
|
||||
<button class="primary" onclick={handleSendInvite} disabled={sendingInvite}>
|
||||
{#if sendingInvite}<LoaderCircle size={14} class="spin" />{:else}<Gamepad2 size={14} />{/if}
|
||||
Send Game Invite
|
||||
</button>
|
||||
{/snippet}
|
||||
</Modal>
|
||||
|
||||
<style>
|
||||
.social-page {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow-y: auto;
|
||||
padding: 1.6rem 2.2rem 2.5rem;
|
||||
gap: 1.2rem;
|
||||
}
|
||||
.page-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-end;
|
||||
border-bottom: 1px solid var(--line);
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
.title-wrap h1 {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.6rem;
|
||||
}
|
||||
:global(.users-icon) {
|
||||
color: var(--accent);
|
||||
}
|
||||
.lead {
|
||||
color: var(--muted);
|
||||
font-size: 0.88rem;
|
||||
margin-top: 0.2rem;
|
||||
}
|
||||
.tabs-row {
|
||||
display: flex;
|
||||
}
|
||||
.tabs-segmented {
|
||||
display: flex;
|
||||
background: color-mix(in srgb, var(--surface) 80%, transparent);
|
||||
padding: 0.25rem;
|
||||
border-radius: var(--radius-sm);
|
||||
border: 1px solid var(--line);
|
||||
gap: 0.2rem;
|
||||
}
|
||||
.tabs-segmented button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
background: transparent;
|
||||
border: none;
|
||||
padding: 0.45rem 1rem;
|
||||
font-size: 0.85rem;
|
||||
font-weight: 560;
|
||||
color: var(--muted);
|
||||
border-radius: calc(var(--radius-sm) - 2px);
|
||||
transition: all 0.15s;
|
||||
}
|
||||
.tabs-segmented button.active {
|
||||
background: color-mix(in srgb, var(--text) 10%, transparent);
|
||||
color: var(--text);
|
||||
}
|
||||
.friends-layout {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
.add-friend-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.8rem;
|
||||
padding: 0.6rem 1rem;
|
||||
border-radius: var(--radius);
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--line);
|
||||
}
|
||||
.add-friend-input {
|
||||
flex: 1;
|
||||
background: transparent;
|
||||
border: none;
|
||||
font-size: 0.88rem;
|
||||
color: var(--text);
|
||||
outline: none;
|
||||
}
|
||||
.filter-pills {
|
||||
display: flex;
|
||||
gap: 0.4rem;
|
||||
}
|
||||
.pill {
|
||||
padding: 0.3rem 0.75rem;
|
||||
font-size: 0.8rem;
|
||||
font-weight: 560;
|
||||
border-radius: 99rem;
|
||||
background: color-mix(in srgb, var(--text) 6%, transparent);
|
||||
border: 1px solid transparent;
|
||||
color: var(--muted);
|
||||
transition: all 0.15s;
|
||||
}
|
||||
.pill.active {
|
||||
background: color-mix(in srgb, var(--accent) 18%, transparent);
|
||||
border-color: color-mix(in srgb, var(--accent) 45%, transparent);
|
||||
color: var(--text);
|
||||
}
|
||||
.pending-alert {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0.6rem 1rem;
|
||||
border-radius: var(--radius-sm);
|
||||
background: color-mix(in srgb, var(--accent) 12%, transparent);
|
||||
border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
|
||||
}
|
||||
.friends-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
|
||||
gap: 0.9rem;
|
||||
}
|
||||
.friend-card {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0.9rem 1.1rem;
|
||||
border-radius: var(--radius);
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--line);
|
||||
transition: border-color 0.15s, transform 0.12s;
|
||||
}
|
||||
.friend-card:hover {
|
||||
border-color: var(--line-strong);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
.card-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.8rem;
|
||||
cursor: pointer;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.avatar-holder {
|
||||
position: relative;
|
||||
}
|
||||
.status-dot {
|
||||
position: absolute;
|
||||
bottom: -1px;
|
||||
right: -1px;
|
||||
width: 9px;
|
||||
height: 9px;
|
||||
border-radius: 50%;
|
||||
background: var(--muted);
|
||||
border: 2px solid var(--surface);
|
||||
}
|
||||
.status-dot.online {
|
||||
background: var(--success);
|
||||
}
|
||||
.name-block {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
}
|
||||
.user-title {
|
||||
font-weight: 650;
|
||||
font-size: 0.92rem;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.playing-on {
|
||||
color: var(--accent);
|
||||
font-weight: 560;
|
||||
}
|
||||
.online-label {
|
||||
color: var(--success);
|
||||
}
|
||||
.friend-actions, .req-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.3rem;
|
||||
}
|
||||
.danger-hover:hover {
|
||||
color: var(--danger);
|
||||
}
|
||||
.subheading {
|
||||
font-size: 0.92rem;
|
||||
font-weight: 700;
|
||||
margin-bottom: 0.6rem;
|
||||
}
|
||||
/* Direct Messages Split */
|
||||
.messages-split {
|
||||
display: flex;
|
||||
height: 32rem;
|
||||
border-radius: var(--radius);
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--line);
|
||||
overflow: hidden;
|
||||
}
|
||||
.conv-sidebar {
|
||||
width: 15rem;
|
||||
border-right: 1px solid var(--line);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: color-mix(in srgb, var(--surface) 90%, black);
|
||||
}
|
||||
.conv-head {
|
||||
padding: 0.8rem 1rem 0.5rem;
|
||||
letter-spacing: 0.06em;
|
||||
font-weight: 700;
|
||||
}
|
||||
.conv-list {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 0.3rem 0.5rem;
|
||||
gap: 0.2rem;
|
||||
}
|
||||
.conv-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.65rem;
|
||||
padding: 0.55rem 0.7rem;
|
||||
border-radius: var(--radius-sm);
|
||||
background: transparent;
|
||||
border: none;
|
||||
text-align: left;
|
||||
transition: background 0.12s;
|
||||
}
|
||||
.conv-item:hover {
|
||||
background: color-mix(in srgb, var(--text) 6%, transparent);
|
||||
}
|
||||
.conv-item.active {
|
||||
background: color-mix(in srgb, var(--accent) 15%, transparent);
|
||||
}
|
||||
.conv-meta {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
}
|
||||
.conv-name {
|
||||
font-size: 0.86rem;
|
||||
font-weight: 650;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.chat-thread {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.thread-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0.8rem 1.2rem;
|
||||
border-bottom: 1px solid var(--line);
|
||||
}
|
||||
.thread-user {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
.block {
|
||||
display: block;
|
||||
}
|
||||
.messages-scroll {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 1.2rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.6rem;
|
||||
}
|
||||
.bubble-row {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
.bubble-row.is-mine {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.bubble {
|
||||
max-width: 22rem;
|
||||
padding: 0.6rem 0.9rem;
|
||||
border-radius: var(--radius);
|
||||
background: color-mix(in srgb, var(--surface) 90%, var(--text));
|
||||
border: 1px solid var(--line);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.2rem;
|
||||
}
|
||||
.bubble.is-mine {
|
||||
background: color-mix(in srgb, var(--accent) 25%, transparent);
|
||||
border-color: color-mix(in srgb, var(--accent) 50%, transparent);
|
||||
}
|
||||
.bubble-text {
|
||||
font-size: 0.88rem;
|
||||
margin: 0;
|
||||
line-height: 1.35;
|
||||
word-break: break-word;
|
||||
}
|
||||
.bubble-time {
|
||||
align-self: flex-end;
|
||||
color: var(--muted);
|
||||
font-size: 0.68rem;
|
||||
}
|
||||
.message-composer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.6rem;
|
||||
padding: 0.75rem 1.2rem;
|
||||
border-top: 1px solid var(--line);
|
||||
}
|
||||
.composer-input {
|
||||
flex: 1;
|
||||
background: color-mix(in srgb, var(--bg) 60%, transparent);
|
||||
border: 1px solid var(--line);
|
||||
color: var(--text);
|
||||
padding: 0.5rem 0.85rem;
|
||||
border-radius: var(--radius-sm);
|
||||
font-size: 0.88rem;
|
||||
}
|
||||
/* Invites View */
|
||||
.invites-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
|
||||
gap: 1rem;
|
||||
}
|
||||
.invite-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.9rem;
|
||||
padding: 1.2rem;
|
||||
border-radius: var(--radius);
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--line);
|
||||
}
|
||||
.invite-top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.9rem;
|
||||
}
|
||||
.invite-meta {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.15rem;
|
||||
}
|
||||
.server-title {
|
||||
font-size: 1rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
.invite-footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
border-top: 1px solid color-mix(in srgb, var(--line) 40%, transparent);
|
||||
padding-top: 0.7rem;
|
||||
}
|
||||
.invite-btns {
|
||||
display: flex;
|
||||
gap: 0.4rem;
|
||||
}
|
||||
.status-badge {
|
||||
text-transform: capitalize;
|
||||
}
|
||||
.status-badge.accepted {
|
||||
background: color-mix(in srgb, var(--success) 20%, transparent);
|
||||
color: var(--success);
|
||||
}
|
||||
.status-badge.declined {
|
||||
background: color-mix(in srgb, var(--danger) 20%, transparent);
|
||||
color: var(--danger);
|
||||
}
|
||||
.invite-modal-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.8rem;
|
||||
}
|
||||
.modal-select {
|
||||
width: 100%;
|
||||
background: color-mix(in srgb, var(--bg) 60%, transparent);
|
||||
border: 1px solid var(--line);
|
||||
color: var(--text);
|
||||
padding: 0.45rem 0.75rem;
|
||||
border-radius: var(--radius-sm);
|
||||
font-size: 0.88rem;
|
||||
}
|
||||
.badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.3rem;
|
||||
font-size: 0.72rem;
|
||||
font-weight: 600;
|
||||
padding: 0.16rem 0.5rem;
|
||||
border-radius: 99rem;
|
||||
}
|
||||
.center-state, .empty-state {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.8rem;
|
||||
padding: 3rem 1.5rem;
|
||||
text-align: center;
|
||||
border-radius: var(--radius);
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user