mirror of
https://github.com/Raghu-Ch/angular-challenges.git
synced 2026-02-10 12:53:03 -05:00
feat: add leaderboard
This commit is contained in:
@@ -54,19 +54,19 @@ export default defineConfig({
|
||||
ru: 'Руководство'
|
||||
}
|
||||
},
|
||||
// {
|
||||
// label: 'Leaderboard',
|
||||
// autogenerate: {
|
||||
// directory: 'leaderboard',
|
||||
// collapsed: true
|
||||
// },
|
||||
// translations: {
|
||||
// es: 'Leaderboard',
|
||||
// fr: 'Leaderboard',
|
||||
// pt: 'Leaderboard',
|
||||
// ru: 'Leaderboard'
|
||||
// }
|
||||
// },
|
||||
{
|
||||
label: 'Leaderboard',
|
||||
autogenerate: {
|
||||
directory: 'leaderboard',
|
||||
collapsed: true
|
||||
},
|
||||
translations: {
|
||||
es: 'Leaderboard',
|
||||
fr: 'Leaderboard',
|
||||
pt: 'Leaderboard',
|
||||
ru: 'Leaderboard'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Challenges',
|
||||
autogenerate: {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { derived, writable } from 'svelte/store';
|
||||
|
||||
export const token = writable<string | null>(null);
|
||||
export const isConnected = writable(false);
|
||||
|
||||
export const isLoading = writable(true);
|
||||
export const error = writable(false);
|
||||
@@ -18,6 +19,9 @@ export function loadToken() {
|
||||
const persistedToken = localStorage.getItem(TOKEN_KEY);
|
||||
if (persistedToken) {
|
||||
token.set(JSON.parse(persistedToken));
|
||||
isConnected.set(true);
|
||||
} else {
|
||||
isConnected.set(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import UserBox from './UserBox.svelte';
|
||||
import Spinner from './Spinner.svelte';
|
||||
import { token } from '../github/github-store';
|
||||
import { isConnected, token } from '../github/github-store';
|
||||
|
||||
let users = [];
|
||||
let loading = true;
|
||||
@@ -11,7 +11,7 @@
|
||||
if (token) {
|
||||
fetchGitHubUsers();
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
async function fetchGitHubUsers() {
|
||||
try {
|
||||
@@ -71,6 +71,9 @@
|
||||
|
||||
</script>
|
||||
|
||||
{#if !$isConnected}
|
||||
<div class="important-block not-connected">Log in to Github to see the list</div>
|
||||
{:else}
|
||||
{#if loading}
|
||||
<Spinner />
|
||||
{:else if error}
|
||||
@@ -85,8 +88,13 @@
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.not-connected {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.box {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import UserBox from './UserBox.svelte';
|
||||
import Spinner from './Spinner.svelte';
|
||||
import { token } from '../github/github-store';
|
||||
import { isConnected, token } from '../github/github-store';
|
||||
|
||||
|
||||
let users = [];
|
||||
@@ -12,7 +12,7 @@
|
||||
if (token) {
|
||||
fetchGitHubUsers();
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
const createUser = (items) => {
|
||||
const prCounts = {};
|
||||
@@ -55,6 +55,9 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if !$isConnected}
|
||||
<div class="important-block not-connected">Log in to Github to see the list</div>
|
||||
{:else}
|
||||
{#if loading}
|
||||
<Spinner />
|
||||
{:else if error}
|
||||
@@ -68,8 +71,13 @@
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.not-connected {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.box {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import UserBox from './UserBox.svelte';
|
||||
import Spinner from './Spinner.svelte';
|
||||
import { token } from '../github/github-store';
|
||||
import { isConnected, token } from '../github/github-store';
|
||||
|
||||
let users = [];
|
||||
let loading = true;
|
||||
@@ -11,7 +11,7 @@
|
||||
if (token) {
|
||||
fetchGitHubUsers();
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
async function fetchGitHubUsers() {
|
||||
try {
|
||||
@@ -71,6 +71,9 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if !$isConnected}
|
||||
<div class="important-block not-connected">Log in to Github to see the list</div>
|
||||
{:else}
|
||||
{#if loading}
|
||||
<Spinner />
|
||||
{:else if error}
|
||||
@@ -84,8 +87,13 @@
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.not-connected {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.box {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
Reference in New Issue
Block a user