11<template >
22 <div id =" app" >
3- <v-container >
4- <v-row no-gutters justify =" space-around" >
5- <v-col class =" plotly-chart center-content" >
6- <Loading v-if =" plotInfo1 .data === null " />
7- <PlotlyChart v-else :propData =" plotInfo1 " divId="plot1" />
8- </v-col >
9- <v-col class =" plotly-chart center-content" >
10- <LoadingHeart v-if =" plotInfo2 .data === null " />
11- <PlotlyChart v-else :propData =" plotInfo2 " divId="plot2" />
12- </v-col >
13- <v-col class =" plotly-chart center-content" >
14- <Loading v-if =" plotInfo3 .data === null " />
15- <PlotlyChart v-else :propData =" plotInfo3 " divId="plot3" />
16- </v-col >
17- </v-row >
18- </v-container >
3+ <v-row no-gutters >
4+ <v-col
5+ v-bind:key =" item"
6+ v-for =" item in plotItems"
7+ class =" plotly-chart center-content"
8+ >
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 >
1920 </div >
2021</template >
2122<script >
2223import Loading from " ./components/Loading.vue" ;
23- import LoadingHeart from " ./components/LoadingHeart.vue" ;
2424import PlotlyChart from " ./components/PlotlyChart.vue" ;
2525
2626export default {
2727 name: " app" ,
2828 components: {
2929 PlotlyChart,
3030 Loading,
31- LoadingHeart
3231 },
3332 data : function () {
3433 return {
35- plotInfo1: {
36- data: null ,
37- },
38- plotInfo2: {
39- data: null ,
40- },
41- plotInfo3: {
42- data: null ,
43- },
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+ ],
4449 };
4550 },
4651 async mounted () {
47- try {
48- this .fetchData (' a' ).then ((data ) => data .json ()).then (json => this .plotInfo1 .data = json .forks )
49- this .fetchData (' b' ).then ((data ) => data .json ()).then (json => this .plotInfo2 .data = json .forks )
50- this .fetchData (' c' ).then ((data ) => data .json ()).then (json => this .plotInfo3 .data = json .forks )
51-
52- } catch (error) {
53- console .error (" Error fetching data:" , error);
54- }
52+ this .plotItems .forEach ((item ) => {
53+ this .fetchData (" a" , item);
54+ });
5555 },
5656 methods: {
57- async fetchData (username ) {
57+ async fetchData (username , item ) {
5858 try {
59- console .log (" Fetching data..." , process .env .VUE_APP_BACKEND_ROOT_ENDPOINT + ` ${ username} /repos` );
60- return fetch (
61- process .env .VUE_APP_BACKEND_ROOT_ENDPOINT + ` ${ username} /repos`
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 } `
6267 );
68+ item .chartData = await resp .json ();
69+ console .log (item);
6370 } catch (error) {
6471 console .error (" Error fetching data:" , error);
6572 }
@@ -84,12 +91,10 @@ export default {
8491 min-height : 100vh ;
8592 min-width : 100vw ;
8693 max-width : 100vw ;
87- position : absolute ;
8894}
8995
9096body {
9197 scroll-behavior : smooth ;
92- overflow-y : hidden ;
9398 overflow-x : hidden ;
9499 min-width : 100vw ;
95100 max-width : 100vw ;
@@ -100,12 +105,22 @@ body {
100105 border : 1px solid #ccc ;
101106 border-radius : 50px ;
102107 background-color : transparent ;
108+ height : 325px ;
109+ min-width : 325px ;
110+ max-width : 40% ;
103111}
104112
113+ .margin-up {
114+ margin-top : 20px ;
115+ }
105116.center-content {
106117 display : flex ;
118+ flex-direction : column ;
107119 align-items : center ;
108- justify-content : center ;
109- height : 350px ;
120+ justify-content : space-around ;
121+ }
122+
123+ ::-webkit-scrollbar {
124+ display : none ;
110125}
111126 </style >
0 commit comments