mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-12-05 23:35:33 +00:00
* fix(Map): fix design of kills widget, fix design of signatures widget - refactor a lot of code, fixed problem with tooltip blinking * fix(Map): refactor Tracking dialog, refactor Activity tracker, refactor codebase and some styles * fix(Core): don't count character passage on manual add connection * refactor(Core): improved characters tracking API * fix(Core): fixed link signature to system on 'leads to' set * fix(Map): Refactor map settings and prepared it to easier using * fix(Map): Add support new command for following update * fix(Map): Add support new command for main update * refactor(Core): Reduce map init data by using cached system static data * refactor(Core): Reduce map init data by extract signatures loading to a separate event * fix(Core): adjusted IP rate limits * fix(Map): Update design of tracking characters. Added icons for following and main. Added ability to see that character on the station or structure --------- Co-authored-by: achichenkov <aleksei.chichenkov@telleqt.ai> Co-authored-by: Dmitry Popov <dmitriypopovsamara@gmail.com>
53 lines
1.6 KiB
TypeScript
53 lines
1.6 KiB
TypeScript
import { MarkdownComment } from '@/hooks/Mapper/components/mapInterface/components/Comments/components';
|
|
import { useEffect, useRef, useState } from 'react';
|
|
import { CommentType } from '@/hooks/Mapper/types';
|
|
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
|
|
|
export interface CommentsProps {}
|
|
|
|
// eslint-disable-next-line no-empty-pattern
|
|
export const Comments = ({}: CommentsProps) => {
|
|
const [commentsList, setCommentsList] = useState<CommentType[]>([]);
|
|
|
|
const {
|
|
data: { selectedSystems },
|
|
comments: { loadComments, comments, lastUpdateKey },
|
|
} = useMapRootState();
|
|
|
|
const [systemId] = selectedSystems;
|
|
|
|
const ref = useRef({ loadComments, systemId });
|
|
ref.current = { loadComments, systemId };
|
|
|
|
useEffect(() => {
|
|
const commentsBySystem = comments.get(systemId);
|
|
if (!commentsBySystem) {
|
|
return;
|
|
}
|
|
|
|
const els = [...commentsBySystem.comments].sort((a, b) => +new Date(b.updated_at) - +new Date(a.updated_at));
|
|
|
|
setCommentsList(els);
|
|
}, [systemId, lastUpdateKey, comments]);
|
|
|
|
useEffect(() => {
|
|
ref.current.loadComments(systemId);
|
|
}, [systemId]);
|
|
|
|
if (commentsList.length === 0) {
|
|
return (
|
|
<div className="w-full h-full flex justify-center items-center select-none text-stone-400/80 text-sm">
|
|
Not comments found here
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div className="flex flex-col gap-1 whitespace-nowrap overflow-auto text-ellipsis custom-scrollbar">
|
|
{commentsList.map(({ id, text, updated_at, characterEveId }) => (
|
|
<MarkdownComment key={id} text={text} time={updated_at} characterEveId={characterEveId} id={id} />
|
|
))}
|
|
</div>
|
|
);
|
|
};
|