11<template >
22 <div id =" app" >
33 <v-container >
4- <v-row no-gutters alignContent =" center" justify =" space-between" >
5- <v-col md =" 4" >
6- <PlotlyChart :propData =" plotInfo " divId="plot1" />
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" />
78 </v-col >
8- <v-col md =" 4" >
9- <PlotlyChart :propData =" plotInfo " divId="plot2" />
9+ <v-col class =" plotly-chart center-content" >
10+ <LoadingHeart v-if =" plotInfo2 .data === null " />
11+ <PlotlyChart v-else :propData =" plotInfo2 " divId="plot2" />
1012 </v-col >
11- <v-col md =" 4" >
12- <PlotlyChart :propData =" plotInfo " divId="plot3" />
13+ <v-col class =" plotly-chart center-content" >
14+ <Loading v-if =" plotInfo3 .data === null " />
15+ <PlotlyChart v-else :propData =" plotInfo3 " divId="plot3" />
1316 </v-col >
1417 </v-row >
1518 </v-container >
1619 </div >
1720</template >
1821<script >
22+ import Loading from " ./components/Loading.vue" ;
23+ import LoadingHeart from " ./components/LoadingHeart.vue" ;
1924import PlotlyChart from " ./components/PlotlyChart.vue" ;
2025
2126export default {
2227 name: " app" ,
2328 components: {
2429 PlotlyChart,
30+ Loading,
31+ LoadingHeart
2532 },
2633 data : function () {
2734 return {
28- plotInfo: {
35+ plotInfo1: {
36+ data: null ,
37+ },
38+ plotInfo2: {
39+ data: null ,
40+ },
41+ plotInfo3: {
2942 data: null ,
3043 },
31- loadingData: true ,
3244 };
3345 },
34- mounted () {
35- this .fetchData ();
46+ async mounted () {
47+ try {
48+ const [data1 , data2 , data3 ] = await Promise .all ([
49+ this .fetchData (),
50+ this .fetchData (),
51+ this .fetchData (),
52+ ]);
53+
54+ this .plotInfo1 .data = (await data1 .json ()).forks ;
55+ this .plotInfo2 .data = (await data2 .json ()).forks ;
56+ this .plotInfo3 .data = (await data3 .json ()).forks ;
57+ } catch (error) {
58+ console .error (" Error fetching data:" , error);
59+ }
3660 },
3761 methods: {
3862 async fetchData () {
3963 try {
40- this . loadingData = true ;
41- const response = await fetch (
64+ console . log ( " Fetching data... " ) ;
65+ return fetch (
4266 process .env .VUE_APP_BACKEND_ROOT_ENDPOINT + " ArielMAJ/repos"
4367 );
44- const data = await response .json ();
45- this .plotInfo .data = data .forks ;
46- console .log (this .plotInfo .data );
47- this .loadingData = false ;
4868 } catch (error) {
4969 console .error (" Error fetching data:" , error);
5070 }
@@ -65,7 +85,7 @@ export default {
6585 -moz-osx-font-smoothing : grayscale ;
6686 text-align : center ;
6787 color : #2c3e50 ;
68- background-color : bisque ;
88+ background-color : black ;
6989 min-height : 100vh ;
7090 min-width : 100vw ;
7191 max-width : 100vw ;
@@ -79,4 +99,18 @@ body {
7999 min-width : 100vw ;
80100 max-width : 100vw ;
81101}
102+
103+ .plotly-chart {
104+ margin : 20px ;
105+ border : 1px solid #ccc ;
106+ border-radius : 50px ;
107+ background-color : transparent ;
108+ }
109+
110+ .center-content {
111+ display : flex ;
112+ align-items : center ;
113+ justify-content : center ;
114+ height : 350px ;
115+ }
82116 </style >
0 commit comments