Skip to content

Commit fa27930

Browse files
authored
Merge pull request #55 from ArielMAJ/feat/improvements
Feat/improvements
2 parents 600a76b + 2349769 commit fa27930

4 files changed

Lines changed: 117 additions & 29 deletions

File tree

api/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "api"
3-
version = "0.6.0"
3+
version = "0.7.0"
44
description = ""
55
authors = ["ArielMAJ <ariel.maj@hotmail.com>"]
66
readme = "README.md"

vue-front/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "GitHub_Viz",
3-
"version": "0.6.0",
3+
"version": "0.7.0",
44
"private": true,
55
"scripts": {
66
"serve": "vue-cli-service serve",

vue-front/src/App.vue

Lines changed: 57 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,42 @@
55
<v-text-field
66
v-model="username"
77
label="Search for a GitHub username"
8-
hint="Write a GitHub username and press enter to visualize their account information"
8+
hint="Write a GitHub username to visualize their account information"
99
placeholder="ArielMAJ"
1010
clearable
1111
clear-icon="mdi-close-circle"
1212
type="text"
1313
variant="solo-filled"
14-
:rules="[rules.required]"
15-
@keyup.enter="search"
14+
@keyup.enter="
15+
pressedEnter = true;
16+
search();
17+
"
1618
@click:clear="cardOpen = false"
1719
>
1820
</v-text-field>
1921
</v-responsive>
2022
<UserCard
2123
:username="this.username"
2224
:reload-watcher="this.reloadCount"
25+
:exampleUsernames="this.exampleUsernames"
2326
v-if="cardOpen"
2427
/>
28+
<v-responsive v-else max-width="1000" class="mx-auto">
29+
<h3 class="text-center">Or choose one of the following</h3>
30+
<v-chip-group class="justify-center">
31+
<v-chip
32+
v-for="exampleUsername in exampleUsernames"
33+
:key="exampleUsername"
34+
@click="
35+
clickedFastSearch = true;
36+
username = exampleUsername;
37+
search();
38+
"
39+
>
40+
{{ exampleUsername }}
41+
</v-chip>
42+
</v-chip-group>
43+
</v-responsive>
2544
</div>
2645
</template>
2746
<script>
@@ -36,26 +55,47 @@ export default {
3655
data: function () {
3756
return {
3857
cardOpen: false,
39-
rules: {
40-
required: (value) => !!value || "Field is required",
41-
},
4258
username: "",
4359
reloadCount: 0,
60+
exampleUsernames: new Set([
61+
"arielmaj",
62+
"tauanesales",
63+
"torvalds",
64+
"octocat",
65+
"defunkt",
66+
"wouerner",
67+
"mojombo",
68+
"cs50",
69+
]),
70+
clickedFastSearch: false,
71+
pressedEnter: false,
4472
};
4573
},
4674
methods: {
4775
search() {
48-
if (this.username !== "") {
49-
this.reloadCount++;
50-
this.cardOpen = true;
76+
if (this.username === "" || this.username === null) {
77+
this.cardOpen = false;
78+
return;
5179
}
80+
this.reloadCount++;
81+
this.cardOpen = true;
5282
},
5383
},
5484
watch: {
5585
username: _.debounce(function () {
56-
if (this.username !== "" && this.username !== null) {
57-
this.search();
86+
if (this.username === "" || this.username === null) {
87+
this.cardOpen = false;
88+
return;
89+
}
90+
if (this.clickedFastSearch) {
91+
this.clickedFastSearch = false;
92+
return;
93+
}
94+
if (this.pressedEnter) {
95+
this.pressedEnter = false;
96+
return;
5897
}
98+
this.search();
5999
}, 1500),
60100
},
61101
};
@@ -89,6 +129,12 @@ body {
89129
justify-content: center;
90130
}
91131
132+
.flex-row {
133+
display: flex;
134+
flex-direction: row;
135+
justify-content: center;
136+
}
137+
92138
::-webkit-scrollbar {
93139
display: none;
94140
}

vue-front/src/components/UserCard.vue

Lines changed: 58 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<template>
22
<v-responsive>
33
<Loading v-if="this.userData === null" loadingComponentChoice="Dots" />
4+
<div v-else-if="this.userData.notFound === true" class="flex-row">
5+
<div class="card padding-3">
6+
<h2>404: User Not Found</h2>
7+
</div>
8+
</div>
49
<div v-else class="flex-row">
510
<div class="card">
611
<div class="flex-column no-wrap">
@@ -21,21 +26,25 @@
2126
<h2>{{ this.userData.name }}</h2>
2227
<p class="margin-bottom">{{ this.userData.bio }}</p>
2328
<ul class="margin-bottom">
24-
<li><strong>Followers </strong> : {{ this.userData.followers }}</li>
25-
<li><strong>Following </strong> : {{ this.userData.following }}</li>
2629
<li>
27-
<strong>Repositories </strong> :
30+
<strong>Followers:&nbsp;</strong> {{ this.userData.followers }}
31+
</li>
32+
<li>
33+
<strong>Following:&nbsp;</strong> {{ this.userData.following }}
34+
</li>
35+
<li>
36+
<strong>Repositories:&nbsp;</strong>
2837
{{ this.userData.public_repos }}
2938
</li>
3039
</ul>
3140
<ul class="second-desc margin-bottom">
3241
<li v-if="this.userData.location">
33-
<strong>Location</strong> : {{ this.userData.location }}
42+
<strong>Location:&nbsp;</strong> {{ this.userData.location }}
3443
</li>
3544
</ul>
3645
<ul class="margin-bottom">
3746
<li v-if="this.userData.created_at">
38-
<strong>Created</strong> : {{ this.userData.created_at }}
47+
<strong>Created:&nbsp;</strong> {{ this.userData.created_at }}
3948
</li>
4049
</ul>
4150
<Loading
@@ -52,7 +61,7 @@
5261
>
5362
</v-chip-group>
5463
</div>
55-
<div class="external-buttons-column margin-right-auto">
64+
<div class="external-buttons-column">
5665
<v-btn
5766
variant="plain"
5867
icon="mdi-github"
@@ -114,6 +123,10 @@ export default {
114123
type: Number,
115124
required: true,
116125
},
126+
exampleUsernames: {
127+
type: Set,
128+
required: true,
129+
},
117130
},
118131
data: function () {
119132
return { userData: null, userRepos: null, pieChartModalOpen: false };
@@ -131,7 +144,23 @@ export default {
131144
.then((response) => response.json())
132145
.then((data) => {
133146
this.userData = data;
134-
console.log(this.userData);
147+
148+
if (
149+
this.userData.message === "Not Found" ||
150+
this.username === "" ||
151+
this.username === null
152+
) {
153+
this.userData = {
154+
notFound: true,
155+
};
156+
}
157+
158+
this.exampleUsernames.add(this.username.toLowerCase());
159+
if (this.exampleUsernames.size > 20) {
160+
this.exampleUsernames.delete(
161+
this.exampleUsernames.values().next().value
162+
);
163+
}
135164
moment.defaultFormat = "DD.MM.YYYY, HH:mm";
136165
137166
this.userData.created_at = moment(this.userData.created_at).format(
@@ -201,25 +230,31 @@ export default {
201230
.card {
202231
max-width: min(85vw, 800px);
203232
background-color: gainsboro;
204-
color: #000;
233+
color: black;
205234
border-radius: 30px;
206235
box-shadow: 0 5px 10px rgba(154, 160, 185, 0.05),
207236
0 15px 40px rgba(0, 0, 0, 0.1);
208237
display: flex;
209238
padding: 3rem;
239+
padding-right: 0;
210240
font-size: 16px;
211241
margin: 20px auto;
212242
}
213243
244+
.padding-3 {
245+
padding: 3rem;
246+
}
247+
214248
.avatar {
215-
border-radius: 20%;
216-
border: 10px solid #2a2a72;
249+
border-radius: 30%;
250+
border: 6px solid gray;
217251
height: 150px;
218252
width: 150px;
253+
margin-bottom: 5px;
219254
}
220255
221256
.user-info {
222-
color: #000;
257+
/* color: #000; */
223258
margin-left: 2rem;
224259
}
225260
@@ -280,15 +315,16 @@ export default {
280315
.external-buttons-column {
281316
position: relative;
282317
top: -40px;
283-
right: -115px;
318+
right: -50px;
284319
display: flex;
285320
flex-direction: column;
286321
justify-content: flex-start;
287-
padding: 0px 15px;
322+
/* padding: 0px 15px; */
288323
color: white;
324+
margin: 0;
289325
}
290326
.card-external-buttons {
291-
margin-right: auto;
327+
margin: 0;
292328
margin-bottom: 10px;
293329
}
294330
@@ -313,6 +349,7 @@ export default {
313349
flex-direction: column;
314350
align-items: center;
315351
padding: 1rem;
352+
max-width: 90vw;
316353
}
317354
318355
ul.second-desc {
@@ -325,16 +362,21 @@ export default {
325362
.external-buttons-column {
326363
flex-direction: row;
327364
color: black;
328-
margin-top: 30px;
365+
margin-right: auto;
329366
display: inline-block;
330367
top: 0;
331368
right: 0;
332369
}
370+
.user-info {
371+
/* color: #000; */
372+
margin: auto;
373+
}
333374
}
334375
335376
@media (max-width: 450px) {
336377
.user-info ul {
337-
display: none;
378+
/* display: none; */
379+
flex-wrap: wrap;
338380
}
339381
}
340382
</style>

0 commit comments

Comments
 (0)