Updated project grouping
This commit is contained in:
@@ -6,23 +6,31 @@ import Projects from '@/components/projects.vue';
|
|||||||
import Refrences from '@/components/refrences.vue';
|
import Refrences from '@/components/refrences.vue';
|
||||||
import {momentum} from '@/services/momentum.service';
|
import {momentum} from '@/services/momentum.service';
|
||||||
import {sortByProp} from '@ztimson/utils';
|
import {sortByProp} from '@ztimson/utils';
|
||||||
import {ref} from 'vue';
|
import {computed, onMounted, ref, watch} from 'vue';
|
||||||
|
|
||||||
// Get favorites
|
// Get favorites
|
||||||
const products = ref<any[]>([]);
|
const showcase = ref<any[]>([]);
|
||||||
const openSource = ref<any[]>([]);
|
|
||||||
momentum.data.read('Repos').then(resp =>
|
momentum.data.read('Repos').then(resp =>
|
||||||
resp.toSorted(sortByProp('order'))
|
showcase.value = resp.toSorted(sortByProp('order'))
|
||||||
.forEach((r: any) => (r.product ? products : openSource).value.push(r)));
|
);
|
||||||
|
|
||||||
|
const groups = computed(() => showcase.value.reduce((acc, r: any) => {
|
||||||
|
if(!acc[r.type]) acc[r.type] = [];
|
||||||
|
acc[r.type].push(r);
|
||||||
|
return acc;
|
||||||
|
}, {}))
|
||||||
|
|
||||||
// Get repository count
|
// Get repository count
|
||||||
let remainder = ref(0);
|
let projects = ref(0);
|
||||||
fetch('https://git.zakscode.com/api/v1/repos/search?limit=1000', {
|
const remainder = computed(() => projects.value - showcase.value.filter(r => r.source).length);
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
fetch('https://git.zakscode.com/api/v1/repos/search?limit=1000', {
|
||||||
method: 'get',
|
method: 'get',
|
||||||
headers: {"Content-Type": "application/json"}
|
headers: {"Content-Type": "application/json"}
|
||||||
}).then(async (resp: any) => {
|
}).then(async (resp: any) => {
|
||||||
const data = (await resp.json())?.data;
|
projects.value = (await resp.json())?.data?.length;
|
||||||
remainder.value = data.length - openSource.value.length;
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -64,13 +72,9 @@ fetch('https://git.zakscode.com/api/v1/repos/search?limit=1000', {
|
|||||||
<div class="mb-5">
|
<div class="mb-5">
|
||||||
<h3 class="m-0">Projects</h3>
|
<h3 class="m-0">Projects</h3>
|
||||||
<hr class="mb-4">
|
<hr class="mb-4">
|
||||||
<div class="mb-4">
|
<div class="mb-4" v-for="(group, name) in groups">
|
||||||
<h4 class="mb-3 text-muted">Products & Services</h4>
|
<h4 class="mb-3 text-muted">{{name}}</h4>
|
||||||
<projects :projects="products"/>
|
<projects :projects="group"/>
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h4 class="mb-3 text-muted">Open Source</h4>
|
|
||||||
<projects :projects="openSource"/>
|
|
||||||
</div>
|
</div>
|
||||||
<a v-if="remainder" class="float-end m-2" href="https://git.zakscode.com/explore" target="_blank">See {{remainder}} More...</a>
|
<a v-if="remainder" class="float-end m-2" href="https://git.zakscode.com/explore" target="_blank">See {{remainder}} More...</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user