Skip to content

Commit 5001a21

Browse files
committed
Update mikey pro
1 parent 26b09aa commit 5001a21

File tree

12 files changed

+1285
-640
lines changed

12 files changed

+1285
-640
lines changed

.deepsource.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
version = 1
2-
32
exclude_patterns = [
43
"dist",
54
"bundle.js",

client/src/components/App.svelte

Lines changed: 96 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,80 @@
11
<script>
2-
import { onMount } from 'svelte';
2+
import { onMount } from 'svelte';
33
4-
import langs from '../../routes/index.js';
4+
import langs from '../../routes/index.js';
55
6-
import Card from './Card.svelte';
7-
import Progress from './Progress.svelte';
8-
import ScrollTop from './ScrollTop.svelte';
9-
import Styles from './Styles.svelte';
6+
import Card from './Card.svelte';
7+
import Progress from './Progress.svelte';
8+
import ScrollTop from './ScrollTop.svelte';
109
11-
let owner = '';
12-
let currentOwner = '';
13-
let data;
14-
let langCount;
15-
let repoCount;
16-
let placeholder = '[ GitHub Username ]';
17-
let done = false;
18-
let url = false;
10+
let owner = '';
11+
let currentOwner = '';
12+
let data;
13+
let langCount;
14+
let repoCount;
15+
let placeholder = '[ GitHub Username ]';
16+
let done = false;
17+
let url = false;
1918
20-
onMount(async () => {
21-
const windowOwner = `${window.location.pathname.split('/')[1]}`;
22-
if (windowOwner && windowOwner.length > 0) {
23-
currentOwner = windowOwner;
24-
owner = windowOwner;
25-
url = true;
26-
await submit('window');
27-
}
28-
});
19+
onMount(async () => {
20+
const windowOwner = `${window.location.pathname.split('/')[1]}`;
21+
if (windowOwner && windowOwner.length > 0) {
22+
currentOwner = windowOwner;
23+
owner = windowOwner;
24+
url = true;
25+
await submit('window');
26+
}
27+
});
2928
30-
const isDone = () => {
31-
done = true;
32-
};
29+
const isDone = () => {
30+
done = true;
31+
};
3332
34-
const getData = async (owner) => {
35-
try {
36-
const response = await langs(owner);
37-
return response.data;
38-
} catch (error) {
39-
return error;
40-
}
41-
};
33+
const getData = async (owner) => {
34+
try {
35+
const response = await langs(owner);
36+
return response.data;
37+
} catch (error) {
38+
return error;
39+
}
40+
};
4241
43-
const submit = async (event) => {
44-
try {
45-
if (event === 'window' || !event.key || event.key === 'Enter') {
46-
if (event !== 'window') {
47-
event.target.blur();
48-
}
49-
done = false;
50-
data = undefined;
51-
langCount = undefined;
52-
repoCount = undefined;
53-
currentOwner = owner;
54-
owner = '';
55-
const collectData = [];
56-
const allData = await getData(currentOwner);
57-
if (allData.names) {
58-
repoCount = allData.names.length;
59-
}
42+
const submit = async (event) => {
43+
try {
44+
if (event === 'window' || !event.key || event.key === 'Enter') {
45+
if (event !== 'window') {
46+
event.target.blur();
47+
}
48+
done = false;
49+
data = undefined;
50+
langCount = undefined;
51+
repoCount = undefined;
52+
currentOwner = owner;
53+
owner = '';
54+
const collectData = [];
55+
const allData = await getData(currentOwner);
56+
if (allData.names) {
57+
repoCount = allData.names.length;
58+
}
6059
61-
if (allData.space) {
62-
const keys = Object.keys(allData.space);
63-
langCount = keys.length;
64-
for (const key of keys) {
65-
collectData.push({ name: key, percent: allData.space[key] });
66-
}
67-
collectData.sort((a, b) => b.percent - a.percent);
68-
data = collectData;
60+
if (allData.space) {
61+
const keys = Object.keys(allData.space);
62+
langCount = keys.length;
63+
for (const key of keys) {
64+
collectData.push({ name: key, percent: allData.space[key] });
6965
}
66+
collectData.sort((a, b) => b.percent - a.percent);
67+
data = collectData;
7068
}
71-
return true;
72-
} catch (error) {
73-
return error;
7469
}
75-
};
70+
return true;
71+
} catch (error) {
72+
return error;
73+
}
74+
};
7675
</script>
7776

7877
<template>
79-
<Styles />
8078
<img id="logo" src="public/assets/img/gitlang.svg" alt="GITLANG" />
8179
{#if !url}
8280
<h5>
@@ -89,33 +87,43 @@
8987
tabindex="0"
9088
id="search"
9189
type="text"
92-
bind:value={owner}
93-
{placeholder}
94-
on:focus={() => {
90+
bind:value="{owner}"
91+
placeholder="{placeholder}"
92+
on:focus="{() => {
9593
placeholder = '';
96-
}}
97-
on:blur={() => {
94+
}}"
95+
on:blur="{() => {
9896
placeholder = '[ GitHub Username ]';
99-
}}
100-
on:keydown={submit}
97+
}}"
98+
on:keydown="{submit}"
10199
autocorrect="off"
102100
autocapitalize="none"
103101
/>
104102

105-
<button on:click={submit}>Submit</button>
103+
<button on:click="{submit}">Submit</button>
106104
</div>
107105
{/if}
108106

109107
<div id="results">
110108
{#if currentOwner}
111-
<Card {langCount} {repoCount} {currentOwner} {data} />
109+
<Card
110+
langCount="{langCount}"
111+
repoCount="{repoCount}"
112+
currentOwner="{currentOwner}"
113+
data="{data}"
114+
/>
112115
{/if}
113116
{#if data}
114117
<table>
115118
<tbody id="tbody">
116119
{#if data.length > 0}
117120
{#each data as dat, index}
118-
<Progress {dat} {index} {langCount} {isDone} />
121+
<Progress
122+
dat="{dat}"
123+
index="{index}"
124+
langCount="{langCount}"
125+
isDone="{isDone}"
126+
/>
119127
{/each}
120128
{:else}
121129
<h4>User Not Found</h4>
@@ -135,19 +143,19 @@
135143
</template>
136144

137145
<style>
138-
#input-area {
139-
padding-bottom: 20px;
140-
display: flex;
141-
flex-direction: column;
142-
align-items: center;
143-
}
146+
#input-area {
147+
padding-bottom: 20px;
148+
display: flex;
149+
flex-direction: column;
150+
align-items: center;
151+
}
144152
145-
#results {
146-
width: 100%;
147-
padding: 0 0 10px 0;
148-
text-align: center;
149-
display: flex;
150-
flex-direction: column;
151-
align-items: center;
152-
}
153+
#results {
154+
width: 100%;
155+
padding: 0 0 10px 0;
156+
text-align: center;
157+
display: flex;
158+
flex-direction: column;
159+
align-items: center;
160+
}
153161
</style>

client/src/components/Card.svelte

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<script>
2-
export let langCount;
3-
export let repoCount;
4-
export let currentOwner;
5-
export let data;
2+
export let langCount;
3+
export let repoCount;
4+
export let currentOwner;
5+
export let data;
66
7-
const url = `https://github.com/${currentOwner}`;
7+
const url = `https://github.com/${currentOwner}`;
88
</script>
99

1010
<template>
1111
<div id="card">
1212
{#if currentOwner}
13-
<a id="owner" href={url}>{currentOwner}</a>
13+
<a id="owner" href="{url}">{currentOwner}</a>
1414
{/if}
1515
{#if data && data.length > 0}
1616
{#if repoCount || langCount}
@@ -30,33 +30,33 @@
3030
</template>
3131

3232
<style>
33-
#card {
34-
display: flex;
35-
flex-direction: column;
36-
justify-content: center;
37-
align-items: center;
38-
color: #e8e6e2;
39-
}
33+
#card {
34+
display: flex;
35+
flex-direction: column;
36+
justify-content: center;
37+
align-items: center;
38+
color: #e8e6e2;
39+
}
4040
41-
#owner {
42-
font-size: 20px;
43-
padding: 10px 10px 10px 10px;
44-
margin-bottom: 12px;
45-
animation: fadeIn 0.1s ease 0s forwards;
46-
border-bottom: 1px solid #e8e6e2;
47-
color: #e8e6e2;
48-
}
49-
#counts {
50-
display: flex;
51-
flex-direction: row;
52-
justify-content: center;
53-
align-items: center;
54-
padding-bottom: 15px;
55-
}
41+
#owner {
42+
font-size: 20px;
43+
padding: 10px 10px 10px 10px;
44+
margin-bottom: 12px;
45+
animation: fadeIn 0.1s ease 0s forwards;
46+
border-bottom: 1px solid #e8e6e2;
47+
color: #e8e6e2;
48+
}
49+
#counts {
50+
display: flex;
51+
flex-direction: row;
52+
justify-content: center;
53+
align-items: center;
54+
padding-bottom: 15px;
55+
}
5656
57-
#repos,
58-
#lang {
59-
font-size: 15px;
60-
animation: fadeIn 0.1s ease 0s forwards;
61-
}
57+
#repos,
58+
#lang {
59+
font-size: 15px;
60+
animation: fadeIn 0.1s ease 0s forwards;
61+
}
6262
</style>

0 commit comments

Comments
 (0)