blob: 1c55a9dd4fe03dd0cb33b4439afe733b7aee7753 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
<script lang="ts">
import ParallaxImage from '$lib/Image/ParallaxImage.svelte';
import root from '$lib/Utility/root';
import identity from '$stores/identity';
import locale from '$stores/locale';
import Icon from '@iconify/svelte';
export let live: any;
export let pinStream: (streamer: string) => void;
export let pinnedStreams: string[];
export let icon: string;
</script>
<div class="stream card">
{#if $identity.id !== -2}
<div class="pin-icon">
<a
href={'#'}
onclick={(e) => {
e.preventDefault();
pinStream(live.streamer);
}}
>
<Icon
icon={`pajamas:thumbtack${pinnedStreams.includes(live.streamer) ? '-solid' : ''}`}
width="1em"
/>
</a>
</div>
{/if}
<p class="stream-heading">
{#if live.streaming}
<b class="live">{$locale().hololive.live}</b
>{:else if new Date(live.time).getTime() < Date.now()}
<span class="ended">{$locale().hololive.ended}</span>{:else}
<span class="upcoming">{$locale().hololive.upcoming}</span>{/if}
<span class="opaque">|</span>
{#if icon}
<a href={root(`/hololive/${encodeURIComponent(live.streamer)}`)}>
<img src={icon} alt="Avatar" class="stream-icon" />
</a>
{/if}
<a href={root(`/hololive/${encodeURIComponent(live.streamer)}`)} class="streamer-link">
<b>{live.streamer}</b>
</a>
<br />
{$locale().hololive.dateFormatter(new Date(live.time))}
{#if live.guests.length > 0}
{$locale().hololive.with}{live.guests
.join($locale().hololive.comma)
.replace(
new RegExp(`${$locale().hololive.comma}([^${$locale().hololive.commaNoSpace}]+)$`, 'g'),
`${$locale().hololive.comma}${$locale().hololive.ampersand}$1`
)}
{/if}
</p>
<a href={live.link} class="preview" target="_blank">
<span class="preview-image">
<ParallaxImage
source={live.livePreviewImage}
alternativeText="Stream Thumbnail"
limit={12.5}
duration={2750}
/>
</span>
</a>
</div>
<style lang="scss">
$transition: transform 0.3s ease;
.preview {
// margin: 0.15rem;
:global(img) {
border-radius: 8px;
height: 20vh;
object-fit: cover;
}
.preview-image {
transition: $transition;
}
&:hover {
.preview-image {
position: relative;
z-index: 2;
transition: $transition;
transform: scale(1.025) !important;
}
}
display: flex;
justify-content: center;
align-items: center;
}
.live {
color: var(--base0F);
}
.upcoming {
color: var(--base0C);
}
.ended {
color: var(--base0D);
}
.pin-icon {
position: absolute;
right: 0;
top: 0;
padding: 0.75rem;
}
.stream {
position: relative;
}
.stream-heading {
padding-right: 2em;
padding-left: 2.5em;
}
.stream-icon {
$size: 2em;
position: absolute;
top: 0;
left: 0;
border-radius: 8px;
width: $size;
height: $size;
margin: 0.75rem;
object-fit: cover;
transition: $transition;
&:hover {
z-index: 2;
transition: $transition;
transform: scale(1.1);
}
}
.streamer-link {
color: var(--fg);
text-decoration: none;
}
</style>
|