Files
outline/app/scenes/Settings/Features.tsx
Tom Moor fc8c20149f feat: Comments (#4911)
* Comment model

* Framework, model, policy, presenter, api endpoint etc

* Iteration, first pass of UI

* fixes, refactors

* Comment commands

* comment socket support

* typing indicators

* comment component, styling

* wip

* right sidebar resize

* fix: CMD+Enter submit

* Add usePersistedState
fix: Main page scrolling on comment highlight

* drafts

* Typing indicator

* refactor

* policies

* Click thread to highlight
Improve comment timestamps

* padding

* Comment menu v1

* Change comments to use editor

* Basic comment editing

* fix: Hide commenting button when disabled at team level

* Enable opening sidebar without mark

* Move selected comment to location state

* Add comment delete confirmation

* Add comment count to document meta

* fix: Comment sidebar togglable
Add copy link to comment

* stash

* Restore History changes

* Refactor right sidebar to allow for comment animation

* Update to new router best practices

* stash

* Various improvements

* stash

* Handle click outside

* Fix incorrect placeholder in input
fix: Input box appearing on other sessions erroneously

* stash

* fix: Don't leave orphaned child comments

* styling

* stash

* Enable comment toggling again

* Edit styling, merge conflicts

* fix: Cannot navigate from insights to comments

* Remove draft comment mark on click outside

* Fix: Empty comment sidebar, tsc

* Remove public toggle

* fix: All comments are recessed
fix: Comments should not be printed

* fix: Associated mark should be removed on comment delete

* Revert unused changes

* Empty state, basic RTL support

* Create dont toggle comment mark

* Make it feel more snappy

* Highlight active comment in text

* fix animation

* RTL support

* Add reply CTA

* Translations
2023-02-25 12:03:05 -08:00

100 lines
3.1 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 { observer } from "mobx-react";
import { BeakerIcon } from "outline-icons";
import * as React from "react";
import { Trans, useTranslation } from "react-i18next";
import { TeamPreference } from "@shared/types";
import Heading from "~/components/Heading";
import Scene from "~/components/Scene";
import Switch from "~/components/Switch";
import Text from "~/components/Text";
import useCurrentTeam from "~/hooks/useCurrentTeam";
import useStores from "~/hooks/useStores";
import useToasts from "~/hooks/useToasts";
import SettingRow from "./components/SettingRow";
function Features() {
const { auth } = useStores();
const team = useCurrentTeam();
const { t } = useTranslation();
const { showToast } = useToasts();
const handlePreferenceChange = async (
ev: React.ChangeEvent<HTMLInputElement>
) => {
const preferences = {
...team.preferences,
[ev.target.name]: ev.target.checked,
};
await auth.updateTeam({ preferences });
showToast(t("Settings saved"), {
type: "success",
});
};
return (
<Scene title={t("Features")} icon={<BeakerIcon color="currentColor" />}>
<Heading>{t("Features")}</Heading>
<Text type="secondary">
<Trans>
Manage optional and beta features. Changing these settings will affect
the experience for all members of the workspace.
</Trans>
</Text>
{team.collaborativeEditing && (
<SettingRow
name={TeamPreference.SeamlessEdit}
label={t("Seamless editing")}
description={t(
`When enabled documents are always editable for team members that have permission. When disabled there is a separate editing view.`
)}
>
<Switch
id={TeamPreference.SeamlessEdit}
name={TeamPreference.SeamlessEdit}
checked={team.getPreference(TeamPreference.SeamlessEdit, true)}
onChange={handlePreferenceChange}
/>
</SettingRow>
)}
{/* <SettingRow
name={TeamPreference.Commenting}
label={
<Flex align="center">
{t("Commenting")} <Badge>Beta</Badge>
</Flex>
}
description={t(
"When enabled team members can add comments to documents."
)}
>
<Switch
id={TeamPreference.Commenting}
name={TeamPreference.Commenting}
checked={team.getPreference(TeamPreference.Commenting, false)}
disabled={!team.collaborativeEditing}
onChange={handlePreferenceChange}
/>
</SettingRow> */}
{team.avatarUrl && (
<SettingRow
name={TeamPreference.PublicBranding}
label={t("Public branding")}
description={t(
"Show your teams logo on public pages like login and shared documents."
)}
>
<Switch
id={TeamPreference.PublicBranding}
name={TeamPreference.PublicBranding}
checked={team.getPreference(TeamPreference.PublicBranding, false)}
onChange={handlePreferenceChange}
/>
</SettingRow>
)}
</Scene>
);
}
export default observer(Features);