-
Notifications
You must be signed in to change notification settings - Fork 3
[fix]お知らせ欄を更新日時順に変更 #1977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: gm3/develop
Are you sure you want to change the base?
[fix]お知らせ欄を更新日時順に変更 #1977
Conversation
hikahana
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
できればですが、毎回PR消さなくても良いです!
どこで何のコメントしてどうなっているかの情報把握が少し面倒になりそうなので!!!
お願いします~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ちょっと差分以外のところにコメントできないからここで
下みたいにsortedNewsを消したところをnewsにしたらエラー無く動くと思っているんだけどどうですかね?
エラーの詳細についても貼ってもらえるとうれしいかもです。
const { news, error, isLoading } = useGetNews();
~略~
const newsList = news.map((item, index) => {
const date = formattedDates[index] ?? 'お知らせはありません。';
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
これで解決できると思われ
const NewsList: FC<NewsListProps> = () => {
const { news, error, isLoading } = useGetNews();
if (news === undefined) return [];
const formattedDates = news.map((item) => {
const date = new Date(item.createdAt);
const formattedDate = format(date, 'yyyy/MM/dd');
return formattedDate;
});
const newsList = news.map((item, index) => {
const date = formattedDates[index] ?? 'お知らせはありません。';
return (
<div key={item.id} className="flex flex-col gap-2">
<span className="w-24 text-base font-medium text-font">{date}</span>
<span className="w-full whitespace-pre-line text-base font-medium text-font">
{item.body}
</span>
</div>
);
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
これで解決できると思われ
const NewsList: FC<NewsListProps> = () => {
const { news, error, isLoading } = useGetNews();
if (news === undefined) return [];
const formattedDates = news.map((item) => {
const date = new Date(item.createdAt);
const formattedDate = format(date, 'yyyy/MM/dd');
return formattedDate;
});
const newsList = news.map((item, index) => {
const date = formattedDates[index] ?? 'お知らせはありません。';
return (
<div key={item.id} className="flex flex-col gap-2">
<span className="w-24 text-base font-medium text-font">{date}</span>
<span className="w-full whitespace-pre-line text-base font-medium text-font">
{item.body}
</span>
</div>
);
});

対応Issue
resolve #1941
概要
実装詳細
画面スクリーンショット等
テスト項目
備考
前のPRのレビューで指摘されたconst部分消したらエラーになったのでそのままにしてあります