Skip to content

Commit 4c21bae

Browse files
Merge pull request #49 from Rikublender3d/feat/optimization
feat:add a/b test and author API
2 parents d937823 + 26d95aa commit 4c21bae

File tree

25 files changed

+2577
-527
lines changed

25 files changed

+2577
-527
lines changed

package-lock.json

Lines changed: 1168 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"prepare": "husky install"
1515
},
1616
"dependencies": {
17+
"@google-analytics/data": "^5.2.1",
1718
"framer-motion": "^12.25.0",
1819
"hamburger-react": "^2.5.2",
1920
"isomorphic-dompurify": "^2.28.0",

public/next.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

public/note.svg

Lines changed: 5 additions & 0 deletions
Loading

src/app/about/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ export default function AboutPage() {
344344
</div>
345345
<div className="rounded-lg border border-gray-200 bg-white p-6">
346346
<h3 className="mb-2 text-xl font-semibold text-[color:var(--foreground)]">
347-
医療法人社団芯聖会
347+
一般社団法人 未来医療連携機構
348348
</h3>
349349
<Link
350350
href="https://shinsei-kai.jp/"

src/app/draft/[id]/page.tsx

Lines changed: 5 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { SafeHTML } from '@/components/SafeHTML'
1111
import { ArticleCard } from '@/components/ArticleCard'
1212
import { TableOfContents } from '@/components/TableOfContents'
1313
import { ArticleSidebar } from '@/components/ArticleSidebar'
14+
import ShareButtons from '@/components/ShareButtons'
1415
import { notFound } from 'next/navigation'
1516

1617
export const dynamic = 'force-dynamic'
@@ -160,62 +161,10 @@ export default async function DraftPage({ params, searchParams }: Props) {
160161
</div>
161162
</div>
162163

163-
{/* ソーシャルシェア */}
164-
<div className="mt-8 flex items-center gap-4">
165-
<span className="text-sm font-medium text-gray-600">
166-
シェア:
167-
</span>
168-
<div className="flex gap-2">
169-
<a
170-
href={`https://x.com/intent/tweet?url=${encodeURIComponent(`https://www.ishatohaisha.com/draft/${article.id}?draftKey=${draftKey}`)}&text=${encodeURIComponent(article.title)}`}
171-
target="_blank"
172-
rel="noopener noreferrer"
173-
className="flex h-8 w-8 items-center justify-center rounded-full bg-black text-white transition-colors hover:bg-gray-800"
174-
aria-label="X(旧Twitter)でシェア"
175-
>
176-
<svg
177-
className="h-4 w-4"
178-
fill="currentColor"
179-
viewBox="0 0 24 24"
180-
aria-hidden="true"
181-
>
182-
<path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z" />
183-
</svg>
184-
</a>
185-
<a
186-
href={`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(`https://www.ishatohaisha.com/draft/${article.id}?draftKey=${draftKey}`)}`}
187-
target="_blank"
188-
rel="noopener noreferrer"
189-
className="flex h-8 w-8 items-center justify-center rounded-full bg-blue-600 text-white transition-colors hover:bg-blue-700"
190-
aria-label="Facebookでシェア"
191-
>
192-
<svg
193-
className="h-4 w-4"
194-
fill="currentColor"
195-
viewBox="0 0 24 24"
196-
aria-hidden="true"
197-
>
198-
<path d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z" />
199-
</svg>
200-
</a>
201-
<a
202-
href={`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`https://www.ishatohaisha.com/draft/${article.id}?draftKey=${draftKey}`)}&title=${encodeURIComponent(article.title)}`}
203-
target="_blank"
204-
rel="noopener noreferrer"
205-
className="flex h-8 w-8 items-center justify-center rounded-full bg-blue-600 text-white transition-colors hover:bg-blue-700"
206-
aria-label="LinkedInでシェア"
207-
>
208-
<svg
209-
className="h-4 w-4"
210-
fill="currentColor"
211-
viewBox="0 0 24 24"
212-
aria-hidden="true"
213-
>
214-
<path d="M19 0h-14c-2.761 0-5 2.239-5 5v14c0 2.761 2.239 5 5 5h14c2.762 0 5-2.239 5-5v-14c0-2.761-2.238-5-5-5zm-11 19h-3v-11h3v11zm-1.5-12.268c-.966 0-1.75-.79-1.75-1.764s.784-1.764 1.75-1.764 1.75.79 1.75 1.764-.783 1.764-1.75 1.764zm13.5 12.268h-3v-5.604c0-3.368-4-3.113-4 0v5.604h-3v-11h3v1.765c1.396-2.586 7-2.777 7 2.476v6.759z" />
215-
</svg>
216-
</a>
217-
</div>
218-
</div>
164+
<ShareButtons
165+
url={`https://www.ishatohaisha.com/draft/${article.id}?draftKey=${draftKey}`}
166+
title={article.title}
167+
/>
219168
{/* 関連記事 */}
220169
{relatedArticlesWithEndpoint.length > 0 && (
221170
<div className="mt-12">

src/app/general/[id]/page.tsx

Lines changed: 7 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import { SafeHTML } from '@/components/SafeHTML'
99
import { ArticleCard } from '@/components/ArticleCard'
1010
import { TableOfContents } from '@/components/TableOfContents'
1111
import { ArticleSidebar } from '@/components/ArticleSidebar'
12+
import AuthorInfo from '@/components/AuthorInfo'
13+
import ShareButtons from '@/components/ShareButtons'
1214
import { notFound } from 'next/navigation'
1315
import type { Metadata } from 'next'
1416

@@ -143,80 +145,12 @@ export default async function ArticlePage({ params }: Props) {
143145
</div>
144146

145147
{/* 著者情報セクション */}
146-
<div className="mt-12 rounded-xl border border-gray-200 bg-gray-50 p-6">
147-
<div className="flex items-start gap-4">
148-
<div className="h-16 w-16 overflow-hidden rounded-full bg-gray-300">
149-
<div className="flex h-full w-full items-center justify-center text-2xl text-gray-600">
150-
👨‍⚕️
151-
</div>
152-
</div>
153-
<div className="flex-1">
154-
<h3 className="mb-2 text-lg font-semibold text-[color:var(--foreground)]">
155-
編集部
156-
</h3>
157-
<p className="text-sm text-gray-600">
158-
医者と歯医者の交換日記編集部です。医科歯科連携に関する最新情報や実践的なノウハウをお届けしています。
159-
</p>
160-
</div>
161-
</div>
162-
</div>
148+
<AuthorInfo author={article.author} />
163149

164-
{/* ソーシャルシェア */}
165-
<div className="mt-8 flex items-center gap-4">
166-
<span className="text-sm font-medium text-gray-600">
167-
シェア:
168-
</span>
169-
<div className="flex gap-2">
170-
<a
171-
href={`https://x.com/intent/tweet?url=${encodeURIComponent(`https://www.ishatohaisha.com/general/${article.id}`)}&text=${encodeURIComponent(article.title)}`}
172-
target="_blank"
173-
rel="noopener noreferrer"
174-
className="flex h-8 w-8 items-center justify-center rounded-full bg-black text-white transition-colors hover:bg-gray-800"
175-
aria-label="X(旧Twitter)でシェア"
176-
>
177-
<svg
178-
className="h-4 w-4"
179-
fill="currentColor"
180-
viewBox="0 0 24 24"
181-
aria-hidden="true"
182-
>
183-
<path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z" />
184-
</svg>
185-
</a>
186-
<a
187-
href={`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(`https://www.ishatohaisha.com/general/${article.id}`)}`}
188-
target="_blank"
189-
rel="noopener noreferrer"
190-
className="flex h-8 w-8 items-center justify-center rounded-full bg-blue-600 text-white transition-colors hover:bg-blue-700"
191-
aria-label="Facebookでシェア"
192-
>
193-
<svg
194-
className="h-4 w-4"
195-
fill="currentColor"
196-
viewBox="0 0 24 24"
197-
aria-hidden="true"
198-
>
199-
<path d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z" />
200-
</svg>
201-
</a>
202-
<a
203-
href={`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`https://www.ishatohaisha.com/general/${article.id}`)}&title=${encodeURIComponent(article.title)}`}
204-
target="_blank"
205-
rel="noopener noreferrer"
206-
className="flex h-8 w-8 items-center justify-center rounded-full bg-blue-600 text-white transition-colors hover:bg-blue-700"
207-
aria-label="LinkedInでシェア"
208-
>
209-
<svg
210-
className="h-4 w-4"
211-
fill="currentColor"
212-
viewBox="0 0 24 24"
213-
aria-hidden="true"
214-
>
215-
<path d="M19 0h-14c-2.761 0-5 2.239-5 5v14c0 2.761 2.239 5 5 5h14c2.762 0 5-2.239 5-5v-14c0-2.761-2.238-5-5-5zm-11 19h-3v-11h3v11zm-1.5-12.268c-.966 0-1.75-.79-1.75-1.764s.784-1.764 1.75-1.764 1.75.79 1.75 1.764-.783 1.764-1.75 1.764zm13.5 12.268h-3v-5.604c0-3.368-4-3.113-4 0v5.604h-3v-11h3v1.765c1.396-2.586 7-2.777 7 2.476v6.759z" />
216-
</svg>
217-
</a>
218-
</div>
219-
</div>
150+
<ShareButtons
151+
url={`https://www.ishatohaisha.com/general/${article.id}`}
152+
title={article.title}
153+
/>
220154
{/* 関連記事 */}
221155
{relatedArticlesWithEndpoint.length > 0 && (
222156
<div className="mt-12">

src/app/layout.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import './globals.css'
55
import { Header } from '@/components/layout/Header'
66
import { Footer } from '@/components/layout/Footer'
77
import { Breadcrumb } from '@/components/layout/Breadcrumb'
8+
import { getTags } from '@/lib/microCMS/microcms'
89
import { GoogleTagManager } from '@/components/analytics/GoogleTagManager'
910
import { GoogleTagManagerNoScript } from '@/components/analytics/GoogleTagManager'
1011
import { AutoBtnId } from '@/components/analytics/AutoBtnId'
@@ -49,11 +50,14 @@ export const metadata: Metadata = {
4950
},
5051
}
5152

52-
export default function RootLayout({
53+
export default async function RootLayout({
5354
children,
5455
}: Readonly<{
5556
children: React.ReactNode
5657
}>) {
58+
const tagsRes = await getTags()
59+
const tags = tagsRes.contents.map(({ id, name }) => ({ id, name }))
60+
5761
return (
5862
<html lang="ja" suppressHydrationWarning>
5963
<head>
@@ -62,7 +66,7 @@ export default function RootLayout({
6266
<body className={`${zenKakuGothicNew.variable} antialiased`}>
6367
<GoogleTagManagerNoScript />
6468
<AutoBtnId />
65-
<Header />
69+
<Header tags={tags} />
6670
<Suspense fallback={null}>
6771
<Breadcrumb />
6872
</Suspense>

0 commit comments

Comments
 (0)