mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-12-03 14:32:36 +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>
84 lines
3.1 KiB
TypeScript
84 lines
3.1 KiB
TypeScript
import { Widget } from '@/hooks/Mapper/components/mapInterface/components';
|
|
import { Comments } from '@/hooks/Mapper/components/mapInterface/components/Comments';
|
|
import { InfoDrawer, SystemView, TooltipPosition, WdImgButton } from '@/hooks/Mapper/components/ui-kit';
|
|
import { useRef } from 'react';
|
|
import useMaxWidth from '@/hooks/Mapper/hooks/useMaxWidth.ts';
|
|
import { COMPACT_MAX_WIDTH } from '@/hooks/Mapper/components/mapInterface/widgets/SystemSignatures/constants.ts';
|
|
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
|
import clsx from 'clsx';
|
|
import { CommentsEditor } from '@/hooks/Mapper/components/mapInterface/components/CommentsEditor';
|
|
import { PrimeIcons } from 'primereact/api';
|
|
|
|
export const CommentsWidgetContent = () => {
|
|
const {
|
|
data: { selectedSystems },
|
|
} = useMapRootState();
|
|
|
|
const isNotSelectedSystem = selectedSystems.length !== 1;
|
|
|
|
if (isNotSelectedSystem) {
|
|
return (
|
|
<div className="w-full h-full flex justify-center items-center select-none text-stone-400/80 text-sm">
|
|
System is not selected
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div className={clsx('h-full grid grid-rows-[1fr_auto] gap-1 px-[4px]')}>
|
|
<Comments />
|
|
<CommentsEditor />
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export const CommentsWidget = () => {
|
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
const isCompact = useMaxWidth(containerRef, COMPACT_MAX_WIDTH);
|
|
|
|
const {
|
|
data: { selectedSystems, isSubscriptionActive },
|
|
} = useMapRootState();
|
|
const [systemId] = selectedSystems;
|
|
const isNotSelectedSystem = selectedSystems.length !== 1;
|
|
|
|
return (
|
|
<Widget
|
|
contentClassName="my-1"
|
|
label={
|
|
<div ref={containerRef} className="flex justify-between items-center gap-1 text-xs w-full">
|
|
<div className="flex items-center gap-1">
|
|
{!isCompact && (
|
|
<div className="flex whitespace-nowrap text-ellipsis overflow-hidden text-stone-400">
|
|
Comments {isNotSelectedSystem ? '' : 'in'}
|
|
</div>
|
|
)}
|
|
{!isNotSelectedSystem && <SystemView systemId={systemId} className="select-none text-center" hideRegion />}
|
|
</div>
|
|
<WdImgButton
|
|
className={PrimeIcons.QUESTION_CIRCLE}
|
|
tooltip={{
|
|
position: TooltipPosition.left,
|
|
content: (
|
|
<div className="flex flex-col gap-1">
|
|
<InfoDrawer title={<b className="text-slate-50">How to add/delete comment?</b>}>
|
|
It is possible to use markdown formating. <br />
|
|
Only users with tracking permission can add/delete comments. <br />
|
|
</InfoDrawer>
|
|
<InfoDrawer title={<b className="text-slate-50">Limitations</b>}>
|
|
Each comment length is limited to <b>500</b> characters. <br />
|
|
No more than <b>{isSubscriptionActive ? '500' : '30'}</b> comments are allowed per system*. <br />
|
|
<small>* based on active map subscription.</small>
|
|
</InfoDrawer>
|
|
</div>
|
|
),
|
|
}}
|
|
/>
|
|
</div>
|
|
}
|
|
>
|
|
<CommentsWidgetContent />
|
|
</Widget>
|
|
);
|
|
};
|