chore: add more test data and dev page (#34)

This commit is contained in:
Vojtech Simetka 2022-11-30 18:56:42 +01:00 committed by GitHub
parent ef72a347eb
commit 7d606f082f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 113 additions and 2 deletions

View File

@ -1,10 +1,11 @@
<script lang="ts">
import type { Post } from '$lib/stores/post'
import { users } from '$lib/stores/user'
import { users, type User } from '$lib/stores/user'
import { posts } from '$lib/stores/post'
import Button from '$lib/components/button.svelte'
import image1 from '$lib/temp/assets/1.png'
import image2 from '$lib/temp/assets/2.png'
import image3 from '$lib/temp/assets/3.png'
const testPosts: Post[] = [
{
@ -32,10 +33,93 @@
address: '0x547172511e83121ea8b27f25dc00e7294d9b8b6d',
},
},
{
timestamp: new Date().setDate(new Date().getDate() - 3),
text: 'Unicorn etsy jean shorts gatekeep. Same air plant hashtag tousled poutine pinterest, activated charcoal celiac austin chartreuse.',
user: {
address: '0x33FEd84c219139A464Cc2aF5643584ab51176DaB',
},
},
{
timestamp: new Date().setDate(new Date().getDate() - 3),
text: "Y'all should go check this amazing online magazine https://two.compost.digital/",
user: {
name: 'Cryptocowboy',
avatar: image3,
address: '0x0554369c1f47B130104fC8A6aa5a94fF3b06b0e1',
},
},
{
timestamp: new Date().setDate(new Date().getDate() - 3),
text: "I'm baby tacos literally vaporware banh mi fam listicle jean shorts coloring book enamel pin occupy",
user: {
address: '0x33FEd84c219139A464Cc2aF5643584ab51176DaB',
},
},
{
timestamp: new Date().setDate(new Date().getDate() - 4),
text: 'Decision making by awkward silence.',
user: {
name: 'CoyoteRide',
avatar: image1,
address: '0x2d37a46fad14c4fcaba66660da6a5d99af88bf71',
},
},
{
timestamp: new Date().setDate(new Date().getDate() - 4),
text: "It's an amazing trigger within human nature: the minute someone acknowledges their flaws, not only do we tend to forgive them, but we actually come to admire them.",
user: {
name: 'Lemur',
avatar: image2,
address: '0x032b3c7a6af9bbf38838f582acc8e4074932f2b8',
},
},
{
timestamp: new Date().setDate(new Date().getDate() - 5),
text: 'What were the skies like when you were young?',
user: {
address: '0x547172511e83121ea8b27f25dc00e7294d9b8b6d',
},
},
{
timestamp: new Date().setDate(new Date().getDate() - 5),
text: 'Unicorn etsy jean shorts gatekeep. Same air plant hashtag tousled poutine pinterest, activated charcoal celiac austin chartreuse.',
user: {
address: '0x33FEd84c219139A464Cc2aF5643584ab51176DaB',
},
},
{
timestamp: new Date().setDate(new Date().getDate() - 6),
text: "Y'all should go check this amazing online magazine https://two.compost.digital/",
user: {
name: 'Cryptocowboy',
avatar: image3,
address: '0x0554369c1f47B130104fC8A6aa5a94fF3b06b0e1',
},
},
{
timestamp: new Date().setDate(new Date().getDate() - 6),
text: "I'm baby tacos literally vaporware banh mi fam listicle jean shorts coloring book enamel pin occupy",
user: {
address: '0x33FEd84c219139A464Cc2aF5643584ab51176DaB',
},
},
{
timestamp: new Date().setDate(new Date().getDate() - 7),
text: 'Decision making by awkward silence.',
user: {
name: 'CoyoteRide',
avatar: image1,
address: "We should forgive each other for stupid things we've said in the past.",
},
},
]
function populateWithData() {
posts.set(testPosts)
users.set(testPosts.map((p) => p.user))
const uniqueUsers: Map<string, User> = new Map()
testPosts.forEach((p) => uniqueUsers.set(p.user.address, p.user))
console.log(Array.from(uniqueUsers.values()))
users.set(Array.from(uniqueUsers.values()))
}
</script>

View File

@ -0,0 +1,27 @@
<script lang="ts">
import Avatar from '$lib/components/avatar.svelte'
import Button from '$lib/components/button.svelte'
import UpToTop from '$lib/components/icons/up-to-top.svelte'
import User from '$lib/components/icons/user.svelte'
import Wallet from '$lib/components/icons/wallet.svelte'
import img1 from '$lib/temp/assets/1.png'
</script>
<h2>Buttons</h2>
<Button label="primary" variant="primary" />
<Button label="secondary" variant="secondary" />
<Button label="primary icon" variant="primary" icon={UpToTop} />
<Button label="secondary icon" variant="secondary" icon={UpToTop} />
<Button variant="primary" icon={UpToTop} />
<Button variant="secondary" icon={UpToTop} />
<h2>Icons</h2>
<UpToTop />
<User />
<Wallet />
<h2>Avatar</h2>
<Avatar />
<Avatar src={img1} />