11<template >
22 <div class =" app justify-center" >
3- <v-row no-gutters class =" justify-center" >
4- <v-col
5- v-bind:key =" item"
6- v-for =" item in plotItems"
7- class =" plotly-chart center-content"
3+ <!-- <v-responsive class="mx-auto" max-width="344"> -->
4+ <v-responsive id =" search-bar" max-width =" 700" >
5+ <v-text-field
6+ v-model =" username"
7+ label =" Search for a GitHub username"
8+ hint =" Write a GitHub username and press enter to visualize their account information"
9+ placeholder =" ArielMAJ"
10+ clearable
11+ type =" text"
12+ variant =" solo-filled"
13+ :rules =" [rules.required]"
14+ @keyup.enter =" search"
815 >
9- <h2 class =" margin-up" v-if =" item.chartData !== null" >
10- {{ item.chartData[0].labels[0] }}
11- </h2 >
12- <Loading v-if =" item .chartData === null " />
13- <PlotlyChart
14- v-else
15- :chartData =" item .chartData "
16- :divId =" item .information "
17- />
18- </v-col >
19- </v-row >
16+ </v-text-field >
17+ </v-responsive >
18+ <!-- <v-btn
19+ class="white-- text"
20+ color="primary"
21+ @click="pieChartModalOpen = !pieChartModalOpen"
22+ >Open Repository Visualization
23+ </v-btn> -->
24+ <PieChartModal v-if =" pieChartModalOpen " :username =" this .username " />
2025 </div >
2126</template >
2227<script >
23- import Loading from " ./components/Loading.vue" ;
24- import PlotlyChart from " ./components/PlotlyChart.vue" ;
28+ import PieChartModal from " ./modals/PieChartModal.vue" ;
2529
2630export default {
2731 name: " app" ,
2832 components: {
29- PlotlyChart,
30- Loading,
33+ PieChartModal,
3134 },
3235 data : function () {
3336 return {
34- plotItems: [
35- { information: " allow_forking" , chartData: null },
36- { information: " archived" , chartData: null },
37- { information: " disabled" , chartData: null },
38- { information: " fork" , chartData: null },
39- { information: " has_discussions" , chartData: null },
40- { information: " has_downloads" , chartData: null },
41- { information: " has_issues" , chartData: null },
42- { information: " has_pages" , chartData: null },
43- { information: " has_projects" , chartData: null },
44- { information: " has_wiki" , chartData: null },
45- { information: " is_template" , chartData: null },
46- { information: " private" , chartData: null },
47- { information: " web_commit_signoff_required" , chartData: null },
48- ],
37+ pieChartModalOpen: false ,
38+ rules: {
39+ required : (value ) => !! value || " Field is required" ,
40+ },
41+ username: " " ,
4942 };
5043 },
51- async mounted () {
52- this .plotItems .forEach ((item ) => {
53- this .fetchData (" a" , item);
54- });
55- },
5644 methods: {
57- async fetchData (username , item ) {
58- try {
59- console .log (
60- " Fetching data..." ,
61- process .env .VUE_APP_BACKEND_ROOT_ENDPOINT +
62- ` ${ username} /${ item .information } `
63- );
64- const resp = await fetch (
65- process .env .VUE_APP_BACKEND_ROOT_ENDPOINT +
66- ` ${ username} /${ item .information } `
67- );
68- item .chartData = await resp .json ();
69- console .log (item);
70- } catch (error) {
71- console .error (" Error fetching data:" , error);
45+ search () {
46+ if (this .username !== " " ) {
47+ this .pieChartModalOpen = true ;
7248 }
7349 },
7450 },
@@ -86,11 +62,13 @@ export default {
8662 -webkit-font-smoothing : antialiased ;
8763 -moz-osx-font-smoothing : grayscale ;
8864 text-align : center ;
89- color : #2c3e50 ;
65+ color : rgb ( 4 , 162 , 4 ) ;
9066 background-color : black ;
9167 min-height : 100vh ;
9268 min-width : 100vw ;
9369 max-width : 100vw ;
70+ margin : 0 ;
71+ position : absolute ;
9472}
9573
9674body {
@@ -100,31 +78,16 @@ body {
10078 max-width : 100vw ;
10179}
10280
103- .plotly-chart {
104- margin : 20px ;
105- border : 1px solid #ccc ;
106- border-radius : 50px ;
107- background-color : transparent ;
108- height : 325px ;
109- min-width : 325px ;
110- max-width : 40% ;
111- }
112-
113- .margin-up {
114- margin-top : 20px ;
115- }
116- .center-content {
117- display : flex ;
118- flex-direction : column ;
119- align-items : center ;
120- justify-content : space-around ;
121- }
122-
12381.justify-center {
12482 justify-content : center ;
12583}
12684
12785::-webkit-scrollbar {
12886 display : none ;
12987}
88+
89+ #search-bar {
90+ margin : auto ;
91+ margin-top : 20px ;
92+ }
13093 </style >
0 commit comments