mirror of
https://github.com/yude-jp/yude.jp
synced 2025-01-08 12:30:11 +09:00
Compare commits
6 Commits
24327251ee
...
5a0e87d7d4
Author | SHA1 | Date | |
---|---|---|---|
5a0e87d7d4 | |||
b6f427d605 | |||
92bb8b995c | |||
52c8cd8d1c | |||
22385a42c8 | |||
99f776b861 |
.eslintrc.json
pages
@ -1,6 +1,8 @@
|
||||
{
|
||||
"extends": "next/core-web-vitals",
|
||||
"rules": {
|
||||
"@next/next/no-document-import-in-page": "off"
|
||||
"@next/next/no-document-import-in-page": "off",
|
||||
"@next/next/no-img-element": "off",
|
||||
"react-hooks/exhaustive-deps": "off"
|
||||
}
|
||||
}
|
||||
|
@ -2,44 +2,37 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
|
||||
// Data fetching
|
||||
import axios from 'axios';
|
||||
import useSwr from 'swr'
|
||||
const fetcher = (url) => fetch(url).then((res) => res.json())
|
||||
|
||||
// i18n
|
||||
import { useTranslation, useLanguageQuery } from 'next-export-i18n';
|
||||
|
||||
function App (){
|
||||
const [data, setData] = useState({ hits: [] });
|
||||
useEffect(() => {
|
||||
const fetchData = async () => {
|
||||
const result = await axios(
|
||||
'https://discord.com/api/guilds/723409709306216498/widget.json',
|
||||
);
|
||||
setData(result.data);
|
||||
};
|
||||
fetchData();
|
||||
}, []);
|
||||
if (data === undefined){
|
||||
console.log("[Discord API] データの取得に失敗しました。 / Failed to retrieve data.")
|
||||
return <p></p>
|
||||
}else{
|
||||
const str = JSON.stringify(data)
|
||||
export default function DiscordPlaying() {
|
||||
const { t } = useTranslation();
|
||||
const [query] = useLanguageQuery();
|
||||
|
||||
if (str.indexOf("game") !== -1){
|
||||
const yes_playing = t('yes_playing', {playing: data.members[0].game.name})
|
||||
return <p>{yes_playing}</p>
|
||||
}else{
|
||||
return <></>
|
||||
}
|
||||
const { data, error } = useSwr(
|
||||
`https://discord.com/api/guilds/723409709306216498/widget.json`,
|
||||
fetcher
|
||||
)
|
||||
if (error){
|
||||
console.log("[Discord API] データの取得に失敗しました。 / Failed to retrieve data.")
|
||||
return <></>
|
||||
} else {
|
||||
if (!data) {
|
||||
return <p>Loading...</p>
|
||||
} else {
|
||||
if (data.members) {
|
||||
if (data.members[0].game) {
|
||||
const yes_playing = t('yes_playing', {playing: data.members[0].game.name})
|
||||
return <p>{yes_playing}</p>
|
||||
} else {
|
||||
return <></>
|
||||
}
|
||||
} else {
|
||||
return <></>
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export async function getServerSideProps() {
|
||||
// Fetch data from external API
|
||||
const res = await fetch(url)
|
||||
const data = await res.json()
|
||||
|
||||
// Pass data to the page via props
|
||||
return { props: { data } }
|
||||
}
|
||||
|
||||
export default App;
|
@ -1,20 +0,0 @@
|
||||
// Next.js
|
||||
import Link from 'next/link'
|
||||
import Image from 'next/image'
|
||||
|
||||
const happybusy = (props) => {
|
||||
return (
|
||||
<Link href="https://www.eff.org/pages/blue-ribbon-campaign">
|
||||
<a>
|
||||
<Image
|
||||
src="/images/brstrip.gif"
|
||||
width={150}
|
||||
height={41}
|
||||
alt="EFF Blue Ribbon Campaign"
|
||||
/>
|
||||
</a>
|
||||
</Link>
|
||||
)
|
||||
}
|
||||
|
||||
export default happybusy
|
@ -1,16 +1,16 @@
|
||||
// Next.js
|
||||
import Link from 'next/link'
|
||||
import Image from 'next/image'
|
||||
|
||||
const HappyBusy = (props) => {
|
||||
return (
|
||||
<Link href="https://sites.google.com/site/happybusy/">
|
||||
<a>
|
||||
<Image
|
||||
<img
|
||||
src="/images/busy_banner.png"
|
||||
width={200}
|
||||
height={42}
|
||||
alt="時間のないサイト運営者リング"
|
||||
className="mx-auto"
|
||||
/>
|
||||
</a>
|
||||
</Link>
|
||||
|
@ -40,7 +40,7 @@ const Dropdown = ({ color }) => {
|
||||
: openDropdownPopover();
|
||||
}}
|
||||
>
|
||||
<FontAwesomeIcon icon={faLanguage} className="w-12 h-9" />
|
||||
<FontAwesomeIcon icon={faLanguage} className="text-4xl" />
|
||||
<svg className="-mr-1 ml-2 h-9 w-3" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
||||
<path fillRule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clipRule="evenodd" />
|
||||
</svg>
|
||||
|
@ -11,7 +11,7 @@ const FontAwesomeMenu = (props) => {
|
||||
<div>
|
||||
<Link href={{ pathname: dest, query: query }}>
|
||||
<a>
|
||||
<FontAwesomeIcon icon={icon} className="w-10 h-10 fill-current inline transition duration-200 ease-in-out transform hover:-translate-y-1 hover:scale-110" />
|
||||
<FontAwesomeIcon icon={icon} className="text-4xl fill-current inline transition duration-200 ease-in-out transform hover:-translate-y-1 hover:scale-110" />
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
|
@ -5,8 +5,6 @@ import React, { useState, useEffect } from 'react';
|
||||
import { useTranslation, useLanguageQuery } from 'next-export-i18n';
|
||||
|
||||
import axios from 'axios';
|
||||
import Image from 'next/image'
|
||||
import { list } from 'postcss';
|
||||
|
||||
export default function Minecraft(props) {
|
||||
const { t } = useTranslation();
|
||||
@ -55,7 +53,7 @@ export default function Minecraft(props) {
|
||||
url.push('https://mc-heads.net/avatar/' + data.players.list[i])
|
||||
}
|
||||
for (var i in url){
|
||||
list.push(<Image src={url[i]} key={i} className="inline" height="50" width="50" alt={i}/>)
|
||||
list.push(<img src={url[i]} key={i} className="inline" height="50" width="50" alt={i}/>)
|
||||
}
|
||||
return <div>{list}</div>
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import Image from 'next/image'
|
||||
|
||||
function App (props) {
|
||||
const uuid = props;
|
||||
|
||||
return (
|
||||
<Image
|
||||
<img
|
||||
src={"https://crafatar.com/renders/body/" + uuid.uuid}
|
||||
width={110}
|
||||
height={250}
|
||||
|
@ -5,22 +5,19 @@ import Layout from "./components/Layout"
|
||||
import FAMenu from "./components/Menu/FontAwesomeMenu"
|
||||
|
||||
// Banner
|
||||
import BlueRibbon from "./components/Footer/BlueRibbon"
|
||||
import HappyBusy from "./components/Footer/HappyBusy"
|
||||
|
||||
// Next.js
|
||||
import Image from 'next/image'
|
||||
import Link from 'next/link'
|
||||
|
||||
// i18n
|
||||
import { useTranslation, useLanguageQuery } from 'next-export-i18n';
|
||||
|
||||
// React Router
|
||||
import { useRouter } from 'next/router'
|
||||
import MinecraftMenu from "./components/Menu/MinecraftMenu"
|
||||
|
||||
// Font Awesome
|
||||
import { faDiscord, faGit, faMastodon, faGithub } from '@fortawesome/free-brands-svg-icons'
|
||||
import { faDiscord, faGit, faGithub } from '@fortawesome/free-brands-svg-icons'
|
||||
import { faBook, faUser, faServer, faHouseUser, faHeart } from '@fortawesome/free-solid-svg-icons'
|
||||
|
||||
export default function Index(props) {
|
||||
@ -35,12 +32,12 @@ export default function Index(props) {
|
||||
<Layout title={t('home')}>
|
||||
<div className="my-9 text-center">
|
||||
<div className="m-10">
|
||||
<Image
|
||||
<img
|
||||
className = "mx-auto"
|
||||
src = "/images/avatar_riru.png"
|
||||
alt = "yude's avatar"
|
||||
width = {200}
|
||||
height = {200}
|
||||
unoptimized = {true}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@ -59,7 +56,6 @@ export default function Index(props) {
|
||||
|
||||
{/* Banner */}
|
||||
<div className="mx-auto mt-10">
|
||||
<BlueRibbon />
|
||||
<HappyBusy />
|
||||
</div>
|
||||
|
||||
|
@ -9,7 +9,6 @@ import { useRouter } from 'next/router'
|
||||
import { useTranslation, useLanguageQuery, LanguageSwitcher } from 'next-export-i18n';
|
||||
|
||||
// Next.js
|
||||
import Image from 'next/image'
|
||||
import Link from 'next/link'
|
||||
|
||||
// Custom pages
|
||||
@ -51,7 +50,7 @@ export default function About(props) {
|
||||
<div>
|
||||
<p className="my-2 text-3xl text-center">{t('title')}</p>
|
||||
<div className="w-full">
|
||||
<Image
|
||||
<img
|
||||
src = "/images/dynmap.png"
|
||||
alt = "Minecraft brief world map generated by Dynmap"
|
||||
width = {1354}
|
||||
|
@ -11,8 +11,6 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
||||
|
||||
// Next.js, React
|
||||
import Link from 'next/link'
|
||||
import Image from 'next/image'
|
||||
import { useRouter } from 'next/router'
|
||||
|
||||
// Discord
|
||||
import DiscordStatus from './components/Discord/DiscordStatus'
|
||||
@ -46,7 +44,7 @@ export default function Profile(props) {
|
||||
}
|
||||
<div>
|
||||
<div className="flex mb-10 justify-center">
|
||||
<Image
|
||||
<img
|
||||
className = "rounded-full hover:animate-rumble z-0 p-15"
|
||||
src = "/images/avatar_mel.png"
|
||||
alt = "yude's avatar"
|
||||
|
Loading…
Reference in New Issue
Block a user