Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
itizawa committed Dec 19, 2023
1 parent 3cf1ccf commit c3fef67
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/app/[slug]/[date]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default async function Page({ params }: Props) {
<NippoBreadcrumbs objective={objective} date={dateString} />
<div className="mt-[32px] mb-[8px] flex justify-between">
<p className="text-xl font-bold text-gray-700">{dateString}</p>
{nippo && <NippoShareIcon nippo={nippo} />}
{nippo && <NippoShareIcon slug={objective.slug} nippo={nippo} />}
</div>
{currentUser?._id === objective.createdUserId ? (
<NippoEditor objectiveId={objective._id} nippo={nippo} date={params.date} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ import { Button, Link } from '@nextui-org/react';
import { format } from 'date-fns';

import { Icon } from '~/app/_components/uiParts/icons';
import { URLS } from '~/app/_constants/urls';
import { Nippo } from '~/domains/Nippo';

export const NippoShareIcon = ({ nippo }: { nippo: Nippo }) => {
export const NippoShareIcon = ({ slug, nippo }: { slug: string; nippo: Nippo }) => {
return (
<Link
href={`https://twitter.com/intent/tweet?text=${format(new Date(nippo.date), 'yyyy年MM月dd日')}の日報&hashtags=みんなの日報&url=${
window.location.href
}`}
href={`https://twitter.com/intent/tweet?text=${format(
new Date(nippo.date),
'yyyy年MM月dd日',
)}の日報&hashtags=みんなの日報&url=${URLS.SHARE_NIPPO(slug, nippo.date)}`}
target="_blank"
rel="noopener noreferrer"
>
Expand Down
1 change: 1 addition & 0 deletions src/app/_constants/urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ export const URLS = {
SLUG_DATE: (slug: string, date: string) => `/${slug}/${date}`,
TERM: `${frontUrl}/terms`,
POLICY: `${frontUrl}/policy`,
SHARE_NIPPO: (slug: string, date: string) => `${frontUrl}/${slug}/${date}`,
LOGIN_TO_BACKEND: `${serverUrl}/auth/google`,
};

0 comments on commit c3fef67

Please sign in to comment.