Commit 90cdaed1fb

90cdaed1fb0c11e7f63b6a4b98be0d8c9bb80837

parent: 49a7dc15e3

Unsigned

Alicia Sykes <alicia@omg.lol> · 2024-03-24 12:59 UTC

Writes component to show dicord info

Layout: unified · split

web/src/components/things/DiscordDetailedInfo.astro added +110
@@ -0,0 +1,110 @@
1---
2
3import type { DiscordInfo } from '@utils/fetch-discord-info';
4import { formatDate, timeAgo } from '@utils/dates-n-stuff';
5import FontAwesome from "@components/form/FontAwesome.svelte"
6
7
8interface Props {
9 discordData: DiscordInfo;
10};
11
12const { discordData } = Astro.props;
13
14
15---
16
17<div class="discord-info-wrapper">
18
19 <h3>Discord</h3>
20
21 <ul class="list-table">
22 <li>
23 <span class="lbl">Server Name</span>
24 <span class="val"><img src={discordData.icon} width="16" />{discordData.name}</span>
25 </li>
26 <li>
27 <span class="lbl">Member Count</span>
28 <span class="val">{discordData.memberCount} ({discordData.memberOnlineCount} online)</span>
29 </li>
30 <li>
31 <span class="lbl">Initial Channel</span>
32 <span class="val">{discordData.channel}</span>
33 </li>
34 <li>
35 <span class="lbl">Inviter</span>
36 <span class="val">{discordData.inviter || 'Anon'}</span>
37 </li>
38 <li>
39 <span class="lbl">Join Link</span>
40 <span class="val"><a href={`https://discord.com/invite/${discordData.inviteCode}`}>discord.com/invite/{discordData.inviteCode}</a></span>
41 </li>
42 </ul>
43
44 { discordData.banner && (<img class="banner" width="300" src={discordData.banner} />)}
45
46
47</div>
48
49
50<style lang="scss">
51.discord-info-wrapper {
52 display: flex;
53 flex-direction: column;
54 max-width: 400px;
55}
56
57h3 {
58 margin: 0;
59 font-size: 1.6rem;
60}
61
62h4 {
63 margin: 1rem 0 0 0;
64 font-size: 1.2rem;
65}
66
67ul {
68 padding-left: 0;
69 list-style: none;
70 max-height: 300px;
71 overflow-y: auto;
72 overflow-x: hidden;
73 img {
74 border-radius: var(--curve-sm);
75 }
76 .list-item {
77 display: flex;
78 flex-direction: column;
79 margin-bottom: 0.5rem;
80 }
81 &.list-table {
82 font-size: 0.9rem;
83 padding-left: 0;
84 li {
85 display: flex;
86 justify-content: space-between;
87 padding: 0.1rem 0;
88 .lbl {
89 font-weight: 400;
90 }
91 .val {
92 img {
93 margin-right: 0.5rem;
94 }
95 }
96 &:not(:last-child) {
97 border-bottom: 1px solid #5f53f440;
98 }
99 }
100 }
101}
102
103.banner {
104 width: 80%;
105 margin: 1rem auto 0 auto;
106 display: flex;
107 border-radius: var(--curve-md);
108}
109
110</style>