openreplay/frontend/app/components/Session_/Player/Controls/components/ReadNote.tsx
Delirium e9e3e21a10
feat(ui/tracker): feature flags (#1097)
* fix(player): fix initial visual offset jump check

* change(ui): add empty feature flags page

* change(ui): add empty feature flags page

* fix(ui): some more fixes

* change(ui): add subrouting for sessions tab

* change(ui): more fixes for routing

* change(ui): add flag creation page, flags list table, flag store/type

* change(tracker): flags in tracker

* change(tracker): return all flags

* feat(ui): add API and types connector

* feat(ui): split components to prevent rerendering

* feat(ui): add icon, fix redirect.path crashlooping

* feat(ui): add conditions and stuff, add flags class to tracker to handle stuff

* feat(ui): add condition state and filters

* feat(ui): fix flag creation with api change

* feat(ui): fix flag editing (api changes); simplify new/edit flag component

* feat(ui): add filters, make table pretty :insert_magic_emoji:

* feat(ui): remove rollout percentage from list, remove console logs

* feat(ui): multivar toggler

* feat(tracker): add more methods to tracker

* feat(tracker): more type coverage

* feat(tracker): add tests

* fix(ui): some fixes for multivar

* feat(ui): multivar api support

* fix(ui):start adding tests for fflags

* fix(ui): rm not working file..

* fix(ui): rm unused packages

* fix(ui): remove name field, fix some api and type names

* fix(ui): fix crash

* fix(tracker/ui): keep flags in sessionStorage, support API errors in feature flags storage

* fix(tracker/ui): clear unused things, fix url handling, fix icons rendering etc
2023-06-21 12:35:40 +02:00

99 lines
3.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React from 'react';
import { Icon } from 'UI';
import { tagProps, Note } from 'App/services/NotesService';
import { formatTimeOrDate } from 'App/date';
import { useStore } from 'App/mstore';
import { observer } from 'mobx-react-lite';
import { TeamBadge } from 'Shared/SessionsTabOverview/components/Notes';
interface Props {
note?: Note;
notFound?: boolean;
onClose: () => void;
}
function ReadNote(props: Props) {
const { settingsStore } = useStore();
const { timezone } = settingsStore.sessionSettings;
if (props.notFound || props.note === undefined) {
return (
<div style={{ position: 'absolute', top: '45%', left: 'calc(50% - 200px)' }}>
<div
className="flex items-start flex-col p-4 border gap-2 rounded"
style={{ background: '#FFFEF5', width: 400 }}
>
<div className="flex items-start font-semibold w-full text-xl">
<div style={{ flex: 9 }}>
You do not have access to this note. <br /> Or its deleted.
</div>
<div style={{ flex: 1 }} className="cursor-pointer ml-auto" onClick={props.onClose}>
<Icon name="close" size={18} />
</div>
</div>
<div
onClick={props.onClose}
className="rounded py-2 px-4 mt-2 flex items-center text-blue gap-2 cursor-pointer hover:bg-active-blue"
>
<Icon size={20} name="play-fill" color="main" />
<span>Play Session</span>
</div>
</div>
</div>
);
}
return (
<div
style={{ position: 'absolute', top: 0, left: 0, height: '100%', width: '100%' }}
className="flex items-center justify-center"
>
<div
className="flex items-start !text-lg flex-col p-4 border gap-2 rounded"
style={{ background: '#FFFEF5', width: 500 }}
>
<div className="flex items-center w-full">
<div className="p-2 bg-gray-light rounded-full">
<Icon name="quotes" color="main" size={16} />
</div>
<div className="ml-2">
<div className="text-base">{props.note.userName}</div>
<div className="text-disabled-text text-sm">
{formatTimeOrDate(props.note.createdAt as unknown as number, timezone)}
</div>
</div>
<div className="ml-auto cursor-pointer self-start" onClick={props.onClose}>
<Icon name="close" size={18} />
</div>
</div>
<div className="text-xl py-3 overflow-y-auto capitalize-first" style={{ maxHeight: 400 }}>
{props.note.message}
</div>
<div className="w-full">
<div className="flex items-center gap-2 flex-wrap w-full">
{props.note.tag ? (
<div
// @ts-ignore
style={{ background: tagProps[props.note.tag], userSelect: 'none', fontSize: 11 }}
className="rounded-full text-sm px-2 py-1 text-white flex items-center justify-center"
>
{props.note.tag}
</div>
) : null}
{!props.note.isPublic ? null : <TeamBadge />}
<div
onClick={props.onClose}
className="ml-auto rounded py-2 px-4 flex items-center text-blue gap-2 cursor-pointer hover:bg-active-blue"
>
<Icon size={20} name="play-fill" color="main" />
<span>Play Session</span>
</div>
</div>
</div>
</div>
</div>
);
}
export default observer(ReadNote);