adding git feed
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 1m24s
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 1m24s
This commit is contained in:
56
nginx/vue/src/components/util/CommitHistory.vue
Normal file
56
nginx/vue/src/components/util/CommitHistory.vue
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<script setup>
|
||||||
|
import axios from "axios";
|
||||||
|
import { ref, onMounted } from "vue";
|
||||||
|
|
||||||
|
const url =
|
||||||
|
"https://www.adam-french.co.uk/gitea/api/v1/users/adamf/activities/feeds?limit=1";
|
||||||
|
|
||||||
|
const feed = ref(null);
|
||||||
|
const isLoading = ref(true);
|
||||||
|
const hasError = ref(false);
|
||||||
|
|
||||||
|
async function checkFeed() {
|
||||||
|
try {
|
||||||
|
const res = await axios.get(url);
|
||||||
|
feed.value = res.data[0] || null;
|
||||||
|
hasError.value = false;
|
||||||
|
} catch (err) {
|
||||||
|
hasError.value = true;
|
||||||
|
} finally {
|
||||||
|
isLoading.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
checkFeed();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="justify-center text-center">
|
||||||
|
<div v-if="isLoading">
|
||||||
|
<p>Loading latest activity...</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else-if="hasError">
|
||||||
|
<p>Could not fetch feed. Please try again later.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else-if="feed" class="flex-col justify-center flex">
|
||||||
|
<h3>Last git activity</h3>
|
||||||
|
<img
|
||||||
|
:src="feed.act_user.avatar_url"
|
||||||
|
alt="User avatar"
|
||||||
|
class="avatar"
|
||||||
|
/>
|
||||||
|
<h3>repo: {{ feed.repo.full_name }}</h3>
|
||||||
|
<p>Action: {{ feed.op_type }}</p>
|
||||||
|
<p>Message: {{ JSON.parse(feed.content).Commits[0].Message }}</p>
|
||||||
|
<small> {{ new Date(feed.created).toLocaleString() }}</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else>
|
||||||
|
<p>No activity found.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -5,6 +5,7 @@ import Radio from "@/components/util/Radio.vue";
|
|||||||
import Elle from "@/components/elle/Elle.vue";
|
import Elle from "@/components/elle/Elle.vue";
|
||||||
import Chat from "@/components/util/Chat.vue";
|
import Chat from "@/components/util/Chat.vue";
|
||||||
import MusicPlayer from "@/components/util/MusicPlayer.vue";
|
import MusicPlayer from "@/components/util/MusicPlayer.vue";
|
||||||
|
import CommitHistory from "@/components/util/CommitHistory.vue";
|
||||||
|
|
||||||
import Intro from "./Intro.vue";
|
import Intro from "./Intro.vue";
|
||||||
import Intro2 from "./Intro2.vue";
|
import Intro2 from "./Intro2.vue";
|
||||||
@@ -46,6 +47,10 @@ import Consumption from "./Consumption.vue";
|
|||||||
<Radio
|
<Radio
|
||||||
class="border-primary border bg-bg_primary text-center"
|
class="border-primary border bg-bg_primary text-center"
|
||||||
/>
|
/>
|
||||||
|
<CommitHistory
|
||||||
|
class="border-primary border bg-bg_primary text-center"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- <Elle class="flex-1" /> -->
|
<!-- <Elle class="flex-1" /> -->
|
||||||
<!-- <Chat class="bdr-2 bg-bg_primary" /> -->
|
<!-- <Chat class="bdr-2 bg-bg_primary" /> -->
|
||||||
<!-- <MusicPlayer /> -->
|
<!-- <MusicPlayer /> -->
|
||||||
|
|||||||
Reference in New Issue
Block a user