このコミットが含まれているのは:
2025-06-12 00:46:06 +09:00
コミット 3363fcd2ae
14個のファイルの変更32行の追加171行の削除
-40
ファイルの表示
@@ -1,40 +0,0 @@
import React, { useEffect, useState } from 'react'
import { Link } from 'react-router-dom'
import axios from 'axios'
import { API_BASE_URL, SITE_TITLE } from '../config'
const HomePage = () => {
const [posts, setPosts] = useState([])
useEffect(() => {
const fetchPosts = async () => {
try {
const response = await axios.get(`${ API_BASE_URL }/posts`)
setPosts(response.data)
} catch (error) {
console.error('Failed to fetch posts:', error)
}
}
fetchPosts()
document.title = `${ SITE_TITLE } 〜 ぼざクリも、ぼざろ外も、外伝もあるんだよ。`
}, [])
return (
<div className="flex flex-wrap gap-4 p-4">
{posts.map (post => (
<Link
to={`/posts/${post.id}`}
key={post.id}
className="w-40 h-40 overflow-hidden rounded-lg shadow-md hover:shadow-lg"
>
<img
src={post.thumbnail}
className="object-cover w-full h-full"
/>
</Link>
))}
</div>
)
}
export default HomePage
+1 -10
ファイルの表示
@@ -7,16 +7,7 @@ import { Button } from '@/components/ui/button'
import { toast } from '@/components/ui/use-toast'
import { cn } from '@/lib/utils'
type Tag = { id: number
name: string
category: string }
type Post = { id: number
url: string
title: string
thumbnail: string
tags: Tag[]
viewed: boolean }
import type { Post, Tag } from '@/types'
type Props = { posts: Post[]
setPosts: (posts: Post[]) => void }
+1 -9
ファイルの表示
@@ -7,16 +7,8 @@ import { Button } from '@/components/ui/button'
import { toast } from '@/components/ui/use-toast'
import { cn } from '@/lib/utils'
type Tag = { id: number
name: string
category: string }
import type { Post, Tag } from '@/types'
type Post = { id: number
url: string
title: string
thumbnail: string
tags: Tag[]
viewed: boolean }
type Props = { posts: Post[]
setPosts: (posts: Post[]) => void }
+2 -11
ファイルの表示
@@ -1,18 +1,9 @@
import React, { useEffect, useState } from 'react'
import { Link, useLocation } from 'react-router-dom'
import axios from 'axios'
import { API_BASE_URL, SITE_TITLE } from '../config'
import { API_BASE_URL, SITE_TITLE } from '@/config'
type Tag = { id: number
name: string
category: string }
type Post = { id: number
url: string
title: string
thumbnail: string
tags: Tag[]
viewed: boolean }
import type { Post, Tag } from '@/types'
type Props = { posts: Post[]
setPosts: (posts: Post[]) => void }
+1 -3
ファイルの表示
@@ -10,9 +10,7 @@ import MarkdownIt from 'markdown-it'
import MdEditor from 'react-markdown-editor-lite'
import 'react-markdown-editor-lite/lib/index.css'
type Tag = { id: number
name: string
category: string }
import type { Tag } from '@/types'
const mdParser = new MarkdownIt
-25
ファイルの表示
@@ -1,25 +0,0 @@
import axios from 'axios'
import { useState, useEffect } from 'react'
import WikiEditor from '@/components/WikiEditor'
import { API_BASE_URL } from '../config'
const WikiPage = () => {
const [text, setText] = useState ('')
useEffect (() => {
void (axios.get (`${ API_BASE_URL }/wiki/load`, { params: { page: 'xxx' } })
.then (res => setText (res.data.markdown)))
}, [])
const save = () => {
void (axios.post ('/api/wiki/save', { page: 'xxx',
markdown: text })
.catch (err => console.error ('保存失敗', err)))
}
return <WikiEditor value={text} onChange={setText} onSave={save} />
}
export default WikiPage