-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove swiper library * Move GA utils into a separate file * Move actions into a separate file * Add PlayerRendered component * Add IO for view detection * Add method * Import * Simplify * Import * Use renderer * Update lockfile * Update * Hardcode gtag id * Add label to button * Do not use setTimeout * Decrease thumbnail size * Remove await and perform actions sychronously * Use hls.js from cdn * Add option to set height of thumbnail * Update VideoPlayer usage * Add label * Add browser check * Enable ssr * Delay loading GA * Remove test route * Add hls as global type * Add splash screen in document root * Bump hls js * Update lcokfiel * Add removeSplashScreen method * remove splash screen on load * Remove splash route group * Remove unsused loigic * Show no more videos page * Enable ssr on fetch first video page * Add * Add loadFirstVideo logic * No load from server * Fix slides * Fix var * Add referrals page * Return on empty * Update types * Add referral page * Save refById * Persist referral id * Update pag eurl * Add refById to authState * Sent referral ID to backend * Update invite page * Update invite page * Update page * Add asset * Fix import
- Loading branch information
1 parent
aea3781
commit 4b69796
Showing
47 changed files
with
972 additions
and
677 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<!DOCTYPE html> | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
|
@@ -13,13 +13,58 @@ | |
content="Hot or Not - Hottest videos on this planet!" /> | ||
<meta name="keywords" content="Shorts, Videos, Fun, Hot, Not" /> | ||
<link rel="manifest" href="/manifest.json" /> | ||
|
||
<script | ||
async | ||
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/hls.light.min.js"></script> | ||
|
||
<!-- preconnects --> | ||
|
||
<link rel="dns-prefetch" href="https://hotornot.wtf" /> | ||
<link rel="dns-prefetch" href="https://www.googleapis.com" /> | ||
<link rel="dns-prefetch" href="https://apis.google.com" /> | ||
<link rel="dns-prefetch" href="https://experiments-hon.firebaseapp.com" /> | ||
<link rel="dns-prefetch" href="https://firestore.googleapis.com" /> | ||
<link | ||
rel="dns-prefetch" | ||
href="https://customer-2p3jflss4r4hmpnz.cloudflarestream.com" /> | ||
<link rel="dns-prefetch" href="https://www.googletagmanager.com" /> | ||
|
||
<meta name="theme-color" content="#E96B25" /> | ||
%sveltekit.head% | ||
</head> | ||
<body | ||
data-sveltekit-preload-data="hover" | ||
style="overflow: hidden; background-color: black" | ||
class="h-screen"> | ||
<splash-screen | ||
style=" | ||
display: flex; | ||
position: absolute; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
width: 100%; | ||
height: 100%; | ||
background-color: #000000; | ||
z-index: 15; | ||
"> | ||
<svg style="height: 14rem; width: 14rem"> | ||
<use xlink:href="/icons.sprite.svg#hot-or-not-logo" /> | ||
</svg> | ||
<svg | ||
style=" | ||
margin-top: 2rem; | ||
height: 1.25rem; | ||
width: 1.25rem; | ||
fill: white; | ||
color: white; | ||
opacity: 50%; | ||
" | ||
class="animate-spin-slow"> | ||
<use xlink:href="/icons.sprite.svg#loading" /> | ||
</svg> | ||
</splash-screen> | ||
<div style="display: contents">%sveltekit.body%</div> | ||
</body> | ||
</html> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const debugMode = true | ||
|
||
export const registerPageView = (url: URL = new URL(window.location.href)) => { | ||
if (url?.href) { | ||
window.gtag?.('event', 'page_view', { | ||
page_location: url.href, | ||
}) | ||
} | ||
} | ||
|
||
export const updateConfig = (params?: Gtag.CustomParams) => { | ||
if (window.gtag) { | ||
window.gtag('config', 'G-PPE5XD2VKV', { | ||
...params, | ||
...(debugMode && { debug_mode: true }), | ||
}) | ||
return true | ||
} | ||
} | ||
|
||
export const setUserProperties = (params?: Gtag.CustomParams) => { | ||
window.gtag?.('set', 'user_properties', { | ||
...params, | ||
}) | ||
} | ||
|
||
export const registerEvent = ( | ||
eventName: Gtag.EventNames | string, | ||
eventParams?: Gtag.ControlParams | Gtag.EventParams | Gtag.CustomParams, | ||
) => { | ||
window.gtag?.('event', eventName, { | ||
...eventParams, | ||
...(debugMode && { debug_mode: true }), | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
124 changes: 124 additions & 0 deletions
124
packages/experiments/src/components/layout/PlayerLayout.actions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
import { registerEvent } from '$components/analytics/GA.utils' | ||
import { | ||
shareVideo, | ||
toggleDislike, | ||
toggleLike, | ||
viewVideo, | ||
} from '$lib/db/actions' | ||
import type { UpDownPost } from '$lib/db/db.types' | ||
import { updatePostInWatchHistory } from '$lib/idb/history' | ||
import { authState } from '$stores/auth' | ||
import { get } from 'svelte/store' | ||
|
||
export type WatchProgress = { | ||
totalCount: number | ||
partialWatchedPercentage: number | ||
} | ||
|
||
export async function sharePost(post: UpDownPost) { | ||
try { | ||
await navigator.share({ | ||
title: 'Hot or Not', | ||
text: `Check out this video at UpDown! \n${post.description}`, | ||
url: `https://experiments.hotornot.wtf/up-down/${post.ouid}@${post.oid}`, | ||
}) | ||
} catch (e) { | ||
console.warn("Can't share", e) | ||
} finally { | ||
await shareVideo({ | ||
videoId: post.id, | ||
videoOid: post.oid, | ||
videoUoid: post.ouid, | ||
videoUid: post.video_uid, | ||
}) | ||
|
||
const authStateData = get(authState) | ||
|
||
registerEvent('share_video', { | ||
userId: authStateData.userId, | ||
video_id: post.id, | ||
share_count: post.share_count, | ||
anon: !!authStateData.isLoggedIn, | ||
}) | ||
} | ||
} | ||
|
||
export async function likePost(post: UpDownPost) { | ||
await toggleLike({ | ||
videoId: post.id, | ||
videoOid: post.oid, | ||
videoUoid: post.ouid, | ||
videoUid: post.video_uid, | ||
}) | ||
|
||
// updatePostInWatchHistory('up-down-watch-history', post, { | ||
// liked_by_me: !post.liked_by_me, | ||
// like_count: post.like_count + BigInt(post.liked_by_me ? -1 : 1), | ||
// }) | ||
|
||
const authStateData = get(authState) | ||
|
||
registerEvent('like_video', { | ||
userId: authStateData.userId, | ||
video_id: post.id, | ||
likes: post.likes_count, | ||
anon: !!authStateData.isLoggedIn, | ||
}) | ||
} | ||
|
||
export async function dislikePost(post: UpDownPost) { | ||
await toggleDislike({ | ||
videoId: post.id, | ||
videoOid: post.oid, | ||
videoUoid: post.ouid, | ||
videoUid: post.video_uid, | ||
}) | ||
|
||
// updatePostInWatchHistory('up-down-watch-history', post, { | ||
// liked_by_me: !post.liked_by_me, | ||
// like_count: post.like_count + BigInt(post.liked_by_me ? -1 : 1), | ||
// }) | ||
|
||
const authStateData = get(authState) | ||
|
||
registerEvent('dislike_video', { | ||
userId: authStateData.userId, | ||
video_id: post.id, | ||
likes: post.likes_count, | ||
anon: !!authStateData.isLoggedIn, | ||
}) | ||
} | ||
|
||
export async function viewPost( | ||
post: UpDownPost, | ||
watchProgress?: WatchProgress, | ||
) { | ||
if (!watchProgress) return | ||
const { totalCount, partialWatchedPercentage } = watchProgress | ||
if (totalCount === 0 && partialWatchedPercentage === 0) return | ||
|
||
updatePostInWatchHistory('up-down-watch-history', post) | ||
|
||
const watchCount = (totalCount || 0) + (partialWatchedPercentage || 0) | ||
|
||
if (!watchCount) return | ||
|
||
await viewVideo( | ||
{ | ||
videoId: post.id, | ||
videoOid: post.oid, | ||
videoUoid: post.ouid, | ||
videoUid: post.video_uid, | ||
}, | ||
watchCount, | ||
) | ||
|
||
const authStateData = get(authState) | ||
|
||
registerEvent('view_video', { | ||
userId: authStateData.userId, | ||
video_id: post.id, | ||
view_count: post.views_count, | ||
anon: !!authStateData.isLoggedIn, | ||
}) | ||
} |
Oops, something went wrong.