Skip to content

Instantly share code, notes, and snippets.

@Lackoftactics
Last active February 24, 2019 21:43
Show Gist options
  • Save Lackoftactics/01dafc8fec3a3130000402258cb3f04a to your computer and use it in GitHub Desktop.
Save Lackoftactics/01dafc8fec3a3130000402258cb3f04a to your computer and use it in GitHub Desktop.
Code review part I
<div class="row">
{{ $t("WIND") }}:
{{
** This ternary operator looks weird here, logic should be probably moved to function **
getWindDirection(weather.wind ? weather.wind.direction : 400)
}}
| {{ weather.wind ? weather.wind.speed : "n/a" }}m/s
</div>
** Would think about naming more appropiate than array. chartData?
get chartDataComputed() {
let array = [];
array.push(["Hour", "Temperature"]);
array.push(
...(this.weather.forecast || []).map(f => {
return [f.time, f.temp];
})
);
return array;
}
import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import VueI18n from "vue-i18n";
Vue.use(VueI18n);
import VueGoogleCharts from "vue-google-charts";
Vue.use(VueGoogleCharts);
import { languages } from "@/i18n";
import { defaultLocale } from "@/i18n";
const messages = Object.assign(languages);
Vue.config.productionTip = false;
var i18n = new VueI18n({
locale: defaultLocale,
fallbackLocale: "de",
messages
});
new Vue({
router,
i18n,
render: h => h(App)
}).$mount("#app");
** Good practice to import at the styles? **
import "fomantic-ui-less/semantic.less";
export class SingleDayForecast {
** Why Date as string? You don't need any manipulations? **
date?: string;
averageWeather?: Weather;
forecast?: Array<Weather>;
}
const requestUrl =
** WHY NOT USE String interpolation?? **
API_URL + "?id=" + cityId + "&units=metric" + "&APPID=" + API_KEY;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment