Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Issue List via GitHub API #13

Open
wants to merge 3 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions src/components/IssueCard.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<template>
<a :href="`${issue.html_url}`">
<div class="overflow-hidden h-100 itemcard">
<b-row>
<b-col>
<h1>Issue #{{issue.number}}</h1>
<p class="description">{{issue.title}}</p>

<b-row v-if="issue.labels && issue.labels[0]">
<b-col v-for="label in issue.labels">
<colored-info :color="`#${label.color}`">{{label.name}}</colored-info>
</b-col>
</b-row>
</b-col>
</b-row>
</div>
</a>
</template>

<script setup>
import ColoredInfo from "@/components/ColoredInfo.vue";

defineProps({
issue: Object
})
</script>

<style scoped>
* {
text-decoration: none;
color: #FFF;
}

.itemcard {
background-color: #1E3139;
padding: 1rem 2rem;
transition: 0.3s;
}

.itemcard:hover {
scale: 1.02;
}

.itemcard:hover h1 {
color: var(--bs-primary);
transition: 0.3s;
}

h1 {
font-size: 23pt;
}

img {
max-width: 100%;
max-height: 15vh;
}

.card-text p {
font-size: 11pt;
}
</style>
29 changes: 28 additions & 1 deletion src/pages/ItemPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,14 @@
Du kannst Fragen und Vorschläge auch auf unserem <a :href="$discordJoinUrl" target="_blank">Discord-Server</a> loswerden.
</p>

<img src="/img/issue_01.png" class="mw-100">
<div v-if="issues && issues[0]">
<h1>Issues</h1>
<b-row>
<b-col v-for="issue in issues" xl="4" lg="6" md="12" class="align-self-stretch my-2">
<IssueCard :issue="issue"></IssueCard>
</b-col>
</b-row>
</div>
</b-tab>
</b-tabs>
</b-col>
Expand All @@ -88,8 +95,10 @@ import MarkdownDisplay from "@/components/MarkdownDisplay.vue"
import ItemSummary from "@/components/ItemSummary.vue"
import DownloadModal from "@/components/DownloadModal.vue"
import {event} from "vue-gtag";
import IssueCard from "@/components/IssueCard.vue";

const item = ref(null)
const issues = ref(null)
const route = useRoute()

async function fetchItem() {
Expand All @@ -99,11 +108,29 @@ async function fetchItem() {
)

item.value = await res.json()
await fetchIssues();

event('visit-storage-item', {
event_label: item.value.names[0].value
})
}

async function fetchIssues(){
issues.value = null

let REST_URL = "https://api.github.com/repos"
// Remove github prefix for getting the project path
let projectPath = item.github_url.replace("https://github.com/", "");

// Only request currently opened issues
const res = await fetch(
`${REST_URL}/${projectPath}/issues?state=open`
)

issues.value = await res.json()
console.log(issues.value)
}

fetchItem()
</script>

Expand Down