Hangar/frontend/pages/index.vue

97 lines
3.3 KiB
Vue
Raw Normal View History

2021-01-21 11:36:18 +08:00
<template>
<div>
<v-row>
<v-col cols="12" sm="8" md="5" offset-md="3">
<v-row justify="center" align="center">
<h1>Hangar</h1>
2021-01-23 05:06:44 +08:00
<v-subheader v-text="$t('hangar.subtitle')"></v-subheader>
</v-row>
<v-row justify="center" align="center">
<v-col cols="12">
2021-01-23 05:06:44 +08:00
<v-text-field v-model="projectFilter" :label="$t('hangar.projectSearch.query', [totalProjects])" clearable></v-text-field>
</v-col>
</v-row>
<v-row justify="center" align="center">
<v-col cols="12">
<ProjectList :projects="projects.result"></ProjectList>
</v-col>
</v-row>
</v-col>
<v-col cols="12" sm="2" md="2">
<sponsor />
<v-select></v-select>
2021-01-23 05:06:44 +08:00
<v-checkbox :label="$t('hangar.projectSearch.relevanceSort')"></v-checkbox>
<v-list dense>
<v-subheader>Categories</v-subheader>
<v-list-item-group>
2021-01-23 09:44:41 +08:00
<v-list-item v-for="cat in $store.getters.visibleCategories" :key="cat.apiName">
<v-list-item-icon>
<v-icon v-text="cat.icon" />
</v-list-item-icon>
<v-list-item-content>
2021-01-23 09:44:41 +08:00
<v-list-item-title v-text="$t(`project.category.${cat.apiName}`)"></v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list-item-group>
</v-list>
<v-list dense>
<v-subheader>Platforms</v-subheader>
<v-list-item-group>
<v-list-item v-for="(cat, i) in platforms" :key="i">
<v-list-item-icon>
<v-icon v-text="cat.icon" />
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title v-text="cat.text"></v-list-item-title>
</v-list-item-content> </v-list-item
></v-list-item-group>
</v-list>
</v-col>
</v-row>
</div>
2021-01-21 11:36:18 +08:00
</template>
<script lang="ts">
import { Component, Vue } from 'nuxt-property-decorator';
2021-01-22 15:27:42 +08:00
import { PaginatedResult, Project } from 'hangar-api';
2021-01-21 11:36:18 +08:00
2021-01-22 07:08:06 +08:00
// TODO move somewhere else
interface Platform {
icon: string;
text: string;
}
2021-01-21 11:36:18 +08:00
@Component
export default class Home extends Vue {
2021-01-31 10:00:11 +08:00
// TODO implement filtering
2021-01-22 15:27:42 +08:00
projects?: PaginatedResult<Project>;
totalProjects: Number = 1337;
2021-01-22 07:08:06 +08:00
projectFilter: String | null = null;
// TODO get platforms from server
2021-01-22 07:08:06 +08:00
platforms: Platform[] = [
{
icon: 'mdi-home',
text: 'Test',
},
];
2021-01-21 11:36:18 +08:00
2021-01-22 04:32:08 +08:00
head() {
return {
title: 'Home',
};
}
2021-02-03 07:47:15 +08:00
asyncData() {
// async asyncData({ $api }: Context): Promise<{ projects: [] }> {
return { projects: { result: [] } };
// return { projects: await $api.request<PaginatedResult<Project>>('projects', 'get', { limit: 25, offset: 0 }) };
2021-01-21 11:36:18 +08:00
}
}
</script>