mirror of
https://github.com/LukeHagar/website.git
synced 2025-12-10 12:57:49 +00:00
gh wip
This commit is contained in:
@@ -60,6 +60,7 @@
|
||||
"@appwrite.io/pink-icons": "0.1.0-next.9",
|
||||
"@appwrite.io/repo": "github:appwrite/appwrite#main",
|
||||
"@splinetool/viewer": "0.9.455",
|
||||
"appwrite": "^13.0.1",
|
||||
"compression": "^1.7.4",
|
||||
"express": "^4.18.2",
|
||||
"highlight.js": "^11.9.0",
|
||||
|
||||
63
pnpm-lock.yaml
generated
63
pnpm-lock.yaml
generated
@@ -17,6 +17,9 @@ dependencies:
|
||||
'@splinetool/viewer':
|
||||
specifier: 0.9.455
|
||||
version: 0.9.455
|
||||
appwrite:
|
||||
specifier: ^13.0.1
|
||||
version: 13.0.1
|
||||
compression:
|
||||
specifier: ^1.7.4
|
||||
version: 1.7.4
|
||||
@@ -1864,6 +1867,15 @@ packages:
|
||||
picomatch: 2.3.1
|
||||
dev: true
|
||||
|
||||
/appwrite@13.0.1:
|
||||
resolution: {integrity: sha512-kdOLB5Qbr2beQW72diA/dx8L16LywHcQV1H6oqgGtf64Mo6LsvyIM1hEVxWmFLwAXMaOtsqb7Mcs4+oQHo+WmQ==}
|
||||
dependencies:
|
||||
cross-fetch: 3.1.5
|
||||
isomorphic-form-data: 2.0.0
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
dev: false
|
||||
|
||||
/aproba@2.0.0:
|
||||
resolution: {integrity: sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==}
|
||||
dev: true
|
||||
@@ -1927,6 +1939,10 @@ packages:
|
||||
resolution: {integrity: sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==}
|
||||
dev: true
|
||||
|
||||
/asynckit@0.4.0:
|
||||
resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==}
|
||||
dev: false
|
||||
|
||||
/atob@2.1.2:
|
||||
resolution: {integrity: sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==}
|
||||
engines: {node: '>= 4.5.0'}
|
||||
@@ -2318,6 +2334,13 @@ packages:
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/combined-stream@1.0.8:
|
||||
resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==}
|
||||
engines: {node: '>= 0.8'}
|
||||
dependencies:
|
||||
delayed-stream: 1.0.0
|
||||
dev: false
|
||||
|
||||
/commander@4.1.1:
|
||||
resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==}
|
||||
engines: {node: '>= 6'}
|
||||
@@ -2416,6 +2439,14 @@ packages:
|
||||
resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==}
|
||||
dev: true
|
||||
|
||||
/cross-fetch@3.1.5:
|
||||
resolution: {integrity: sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==}
|
||||
dependencies:
|
||||
node-fetch: 2.6.7
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
dev: false
|
||||
|
||||
/cross-fetch@3.1.8:
|
||||
resolution: {integrity: sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==}
|
||||
dependencies:
|
||||
@@ -2579,6 +2610,11 @@ packages:
|
||||
slash: 3.0.0
|
||||
dev: true
|
||||
|
||||
/delayed-stream@1.0.0:
|
||||
resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==}
|
||||
engines: {node: '>=0.4.0'}
|
||||
dev: false
|
||||
|
||||
/delegates@1.0.0:
|
||||
resolution: {integrity: sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==}
|
||||
dev: true
|
||||
@@ -3177,6 +3213,15 @@ packages:
|
||||
signal-exit: 4.1.0
|
||||
dev: true
|
||||
|
||||
/form-data@2.5.1:
|
||||
resolution: {integrity: sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==}
|
||||
engines: {node: '>= 0.12'}
|
||||
dependencies:
|
||||
asynckit: 0.4.0
|
||||
combined-stream: 1.0.8
|
||||
mime-types: 2.1.35
|
||||
dev: false
|
||||
|
||||
/forwarded@0.2.0:
|
||||
resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==}
|
||||
engines: {node: '>= 0.6'}
|
||||
@@ -3786,6 +3831,12 @@ packages:
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: true
|
||||
|
||||
/isomorphic-form-data@2.0.0:
|
||||
resolution: {integrity: sha512-TYgVnXWeESVmQSg4GLVbalmQ+B4NPi/H4eWxqALKj63KsUrcu301YDjBqaOw3h+cbak7Na4Xyps3BiptHtxTfg==}
|
||||
dependencies:
|
||||
form-data: 2.5.1
|
||||
dev: false
|
||||
|
||||
/jackspeak@2.3.6:
|
||||
resolution: {integrity: sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==}
|
||||
engines: {node: '>=14'}
|
||||
@@ -4428,6 +4479,18 @@ packages:
|
||||
/node-addon-api@6.1.0:
|
||||
resolution: {integrity: sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA==}
|
||||
|
||||
/node-fetch@2.6.7:
|
||||
resolution: {integrity: sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==}
|
||||
engines: {node: 4.x || >=6.0.0}
|
||||
peerDependencies:
|
||||
encoding: ^0.1.0
|
||||
peerDependenciesMeta:
|
||||
encoding:
|
||||
optional: true
|
||||
dependencies:
|
||||
whatwg-url: 5.0.0
|
||||
dev: false
|
||||
|
||||
/node-fetch@2.7.0:
|
||||
resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==}
|
||||
engines: {node: 4.x || >=6.0.0}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
export let placement: NonNullable<FloatingConfig>['placement'] = 'top';
|
||||
export let disabled = false;
|
||||
export let closeOnPointerDown = false;
|
||||
export let disableHoverableContent = false;
|
||||
|
||||
const {
|
||||
elements: { trigger, content, arrow },
|
||||
@@ -16,7 +17,8 @@
|
||||
},
|
||||
openDelay: 0,
|
||||
closeOnPointerDown,
|
||||
forceVisible: true
|
||||
forceVisible: true,
|
||||
disableHoverableContent
|
||||
});
|
||||
|
||||
$: flyParams = (function getFlyParams() {
|
||||
|
||||
22
src/lib/utils/graphql.ts
Normal file
22
src/lib/utils/graphql.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
type CreateGraphqlFetcherArgs = {
|
||||
query: string;
|
||||
url: string;
|
||||
};
|
||||
|
||||
type GraphqlFetcherArgs = {
|
||||
authorizationToken: string;
|
||||
variables: Record<string, unknown>;
|
||||
};
|
||||
|
||||
export function createGraphqlFetcher<T>({ query, url }: CreateGraphqlFetcherArgs) {
|
||||
return async ({ authorizationToken, variables }: GraphqlFetcherArgs) => {
|
||||
return fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${authorizationToken}`
|
||||
},
|
||||
body: JSON.stringify({ query, variables })
|
||||
}).then((res) => res.json() as T);
|
||||
};
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
import { browser } from '$app/environment';
|
||||
import { appwriteInit } from '$lib/appwrite/init';
|
||||
import { onMount } from 'svelte';
|
||||
import { get, writable } from 'svelte/store';
|
||||
|
||||
@@ -51,3 +53,14 @@ export function createCountdown(date: Date) {
|
||||
seconds
|
||||
};
|
||||
}
|
||||
|
||||
export async function isLoggedInGithub() {
|
||||
if (!browser) return false;
|
||||
|
||||
try {
|
||||
const { provider } = await appwriteInit.account.getSession('current');
|
||||
return provider === 'github';
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,12 @@
|
||||
import TicketPNG from '../(assets)/ticket.png';
|
||||
|
||||
function loginGithub() {
|
||||
appwriteInit.account.createOAuth2Session('github');
|
||||
appwriteInit.account.createOAuth2Session(
|
||||
'github',
|
||||
'http://localhost:5173/init/ticket?success=1',
|
||||
'http://localhost:5173/init/ticket?error=1',
|
||||
['read:user']
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
6
src/routes/init/ticket/+page.ts
Normal file
6
src/routes/init/ticket/+page.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import { isLoggedInGithub } from '../helpers';
|
||||
|
||||
export const load = async () => {
|
||||
if (await isLoggedInGithub()) throw redirect(307, '/init/ticket/customize');
|
||||
};
|
||||
@@ -2,11 +2,11 @@
|
||||
import FooterNav from '$lib/components/FooterNav.svelte';
|
||||
import MainFooter from '$lib/components/MainFooter.svelte';
|
||||
import Main from '$lib/layouts/Main.svelte';
|
||||
import { fade, fly, scale, type TransitionConfig } from 'svelte/transition';
|
||||
import { quadOut } from 'svelte/easing';
|
||||
import { fly, type TransitionConfig } from 'svelte/transition';
|
||||
import ShineSVG from '../../(assets)/shine.svg';
|
||||
import Ticket from './ticket.svelte';
|
||||
import TribeToggle from './tribe-toggle.svelte';
|
||||
import { quadIn, quadInOut, quadOut } from 'svelte/easing';
|
||||
|
||||
let name = 'Eldad Fux';
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
return (value - fromMin) * scale + toMin;
|
||||
}
|
||||
|
||||
function ticketOut(node: HTMLElement): TransitionConfig {
|
||||
function ticketOut(_node: HTMLElement): TransitionConfig {
|
||||
// Scale from 1 to 0.75, from opacity 1 to 0.5
|
||||
return {
|
||||
duration: 500,
|
||||
|
||||
73
src/routes/init/ticket/customize/+page.ts
Normal file
73
src/routes/init/ticket/customize/+page.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
import { appwriteInit } from '$lib/appwrite/init';
|
||||
import { createGraphqlFetcher } from '$lib/utils/graphql';
|
||||
import { isLoggedInGithub } from '../../helpers';
|
||||
|
||||
export interface GithubContributionsResponse {
|
||||
data: Data;
|
||||
}
|
||||
|
||||
export interface Data {
|
||||
user: User;
|
||||
}
|
||||
|
||||
export interface User {
|
||||
contributionsCollection: ContributionsCollection;
|
||||
}
|
||||
|
||||
export interface ContributionsCollection {
|
||||
contributionCalendar: ContributionCalendar;
|
||||
}
|
||||
|
||||
export interface ContributionCalendar {
|
||||
totalContributions: number;
|
||||
weeks: Week[];
|
||||
}
|
||||
|
||||
export interface Week {
|
||||
contributionDays: ContributionDay[];
|
||||
}
|
||||
|
||||
export interface ContributionDay {
|
||||
contributionCount: number;
|
||||
date: Date;
|
||||
}
|
||||
|
||||
const fetchContributions = createGraphqlFetcher<GithubContributionsResponse>({
|
||||
query: `query($userName:String!) {
|
||||
user(login: $userName){
|
||||
contributionsCollection {
|
||||
contributionCalendar {
|
||||
totalContributions
|
||||
weeks {
|
||||
contributionDays {
|
||||
contributionCount
|
||||
date
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`,
|
||||
url: 'https://api.github.com/graphql'
|
||||
});
|
||||
|
||||
export const load = async () => {
|
||||
if (await isLoggedInGithub()) {
|
||||
const { providerAccessToken } = await appwriteInit.account.getSession('current');
|
||||
console.log(providerAccessToken);
|
||||
const contributions = await fetchContributions({
|
||||
authorizationToken: providerAccessToken,
|
||||
variables: { userName: 'tglide' }
|
||||
});
|
||||
|
||||
console.log(
|
||||
contributions.data.user.contributionsCollection.contributionCalendar.weeks.flatMap(
|
||||
(week) => week.contributionDays
|
||||
)
|
||||
);
|
||||
|
||||
return {
|
||||
// username: session
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -19,7 +19,7 @@
|
||||
$: alt = tribe === null ? 'No tribe' : tribe;
|
||||
</script>
|
||||
|
||||
<Tooltip>
|
||||
<Tooltip disableHoverableContent>
|
||||
<button
|
||||
class="aw-icon-button aw-box-icon has-border-gradient"
|
||||
use:melt={$root}
|
||||
|
||||
Reference in New Issue
Block a user