0
0
mirror of https://github.com/yude-jp/yude.jp synced 2024-06-09 23:36:01 +09:00

Add "Retrieving server status..." text

This commit is contained in:
yude 2021-05-31 09:59:14 +09:00
parent d7099acd8b
commit 62925709f8
Signed by: yude
GPG Key ID: EB0FE5D925C4A968
3 changed files with 10 additions and 5 deletions

View File

@ -4,5 +4,6 @@
"no_one": "No one is playing.",
"offline": "Server is down.",
"address": "Server address",
"fail": "Failed to retrieve server status."
"fail": "Failed to retrieve server status.",
"loading": "Retrieving server status..."
}

View File

@ -4,5 +4,6 @@
"no_one": "現在、誰もログインしていません。",
"offline": "サーバーがオフラインのようです。",
"address": "サーバー アドレス",
"fail": "サーバーの状態を取得できませんでした。"
"fail": "サーバーの状態を取得できませんでした。",
"loading": "サーバーの状態を取得しています..."
}

View File

@ -13,7 +13,7 @@ export default function Minecraft(props) {
useEffect(() => {
const fetchData = async () => {
const result = await axios(
'https://api.mcsrvstat.us/2/yude.jp',
'https://mcstatus.snowdev.com.br/api/query/v3/yude.jp',
);
setData(result.data);
};
@ -31,16 +31,19 @@ export default function Minecraft(props) {
const playing = t('minecraft:playing', {count: player})
const no_one = t('minecraft:no_one')
const offline = t('minecraft:offline')
const loading = t('minecraft:loading')
return (
<p className="text-center">
{(() => {
if (status) {
if (status == true) {
if (player == undefined || player == 0) {
return <span>{no_one}</span>
} else {
return <span>{playing}</span>
}}else{
}}else if (status == false) {
return <span>{offline}</span>
}else {
return <span>{loading}</span>
}
})()}
</p>