-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #242 from Wizarrrr/master
sync
- Loading branch information
Showing
10 changed files
with
174 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Compile Translations | ||
|
||
on: | ||
push: | ||
branches: | ||
- translations | ||
workflow_dispatch: {} | ||
|
||
permissions: | ||
packages: write | ||
|
||
jobs: | ||
compile: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Checkout the repo and the translations branch | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: translations | ||
|
||
# Install dependencies node and npm | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y nodejs npm | ||
# Install dependencies for frontend | ||
- name: Install dependencies for frontend | ||
run: | | ||
cd frontend | ||
npm install | ||
# Compile translations | ||
- name: Compile translations | ||
run: | | ||
cd frontend | ||
npm run gettext:compile | ||
# Commit and push changes | ||
- name: Commit and push changes | ||
run: | | ||
git config --local user.name "GitHub Action" | ||
git config --local user.email "<>" | ||
git add ./src/language/translations.json | ||
git commit -m "Compile translations" | ||
git push origin translations |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
<template> | ||
<div class="my-[-2rem] mx-[-2rem]"> | ||
<!-- Header --> | ||
<div class="flex justify-between items-center flex-row bg-[#5865F2] py-4 px-6"> | ||
<DiscordLogo /> | ||
<div class="text-white text-sm"> | ||
<span class="font-bold">{{ totalMembersOnline }}</span> | ||
{{ __("Members Online") }} | ||
</div> | ||
</div> | ||
|
||
<!-- Members List --> | ||
<div class="flex flex-col space-y-2 h-[30vh] overflow-y-auto p-4 scrollbar-thin scrollbar-track-white dark:scrollbar-thumb-gray-700 dark:scrollbar-track-gray-800"> | ||
<template v-for="member in members"> | ||
<div class="flex items-center space-x-2"> | ||
<div class="relative w-[26px] h-[26px]"> | ||
<img :src="member.avatar_url" class="w-[26px] h-[26px] rounded-full" alt="Avatar" /> | ||
<span class="absolute bottom-[-2px] right-[-2px] w-3 h-3 rounded-full border-2 border-white dark:border-gray-800" :class="statusColor(member.status)"></span> | ||
</div> | ||
<span>{{ member.username }}</span> | ||
</div> | ||
</template> | ||
</div> | ||
|
||
<!-- Footer --> | ||
<div class="flex justify-between items-center flex-row bg-[#5865F2] py-4 px-6"> | ||
<div class="text-white text-sm"> | ||
{{ __("Join our Discord") }} | ||
</div> | ||
<a :href="invite" target="_blank" rel="noopener noreferrer" class="text-white text-sm"> | ||
{{ __("Join") }} | ||
</a> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent } from "vue"; | ||
import DiscordLogo from "@/assets/img/discord.svg?component"; | ||
export interface Member { | ||
id: string; | ||
username: string; | ||
discriminator: string; | ||
avatar: null; | ||
status: string; | ||
avatar_url: string; | ||
} | ||
export type Members = Member[]; | ||
export default defineComponent({ | ||
name: "Discord", | ||
components: { | ||
DiscordLogo, | ||
}, | ||
data() { | ||
return { | ||
guild: "1020742926856372224", | ||
members: [] as Members, | ||
invite: "", | ||
interval: null as unknown as NodeJS.Timeout, | ||
}; | ||
}, | ||
computed: { | ||
totalMembersOnline() { | ||
return this.members.filter((member) => member.status === "online").length; | ||
}, | ||
}, | ||
methods: { | ||
async loadWidgetAPI(guild: string) { | ||
// Load the Discord Widget API | ||
const response = await this.$axios.get(`https://discord.com/api/guilds/${guild}/widget.json`).catch(() => { | ||
this.$toast.info("Unable to load Discord Widget, this is most likely due to too many requests."); | ||
}); | ||
// Validate the response | ||
if (!response) return; | ||
// Set the widget data | ||
this.invite = response.data.instant_invite; | ||
this.members = response.data.members; | ||
}, | ||
statusColor(status: string) { | ||
switch (status) { | ||
case "online": | ||
return "bg-green-500"; | ||
case "idle": | ||
return "bg-yellow-500"; | ||
case "dnd": | ||
return "bg-red-500"; | ||
case "offline": | ||
return "bg-gray-500"; | ||
default: | ||
return "bg-gray-500"; | ||
} | ||
}, | ||
}, | ||
mounted() { | ||
this.loadWidgetAPI(this.guild); | ||
}, | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters