mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
Enable send to zulip
This commit is contained in:
@@ -5,7 +5,7 @@ import { ShareMode, toShareMode } from "../../lib/shareMode";
|
|||||||
import { GetTranscript, GetTranscriptTopic, UpdateTranscript } from "../../api";
|
import { GetTranscript, GetTranscriptTopic, UpdateTranscript } from "../../api";
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
Heading,
|
Flex,
|
||||||
IconButton,
|
IconButton,
|
||||||
Modal,
|
Modal,
|
||||||
ModalBody,
|
ModalBody,
|
||||||
@@ -41,8 +41,8 @@ export default function ShareAndPrivacy(props: ShareAndPrivacyProps) {
|
|||||||
const [isOwner, setIsOwner] = useState(false);
|
const [isOwner, setIsOwner] = useState(false);
|
||||||
const [shareMode, setShareMode] = useState<ShareOption>(
|
const [shareMode, setShareMode] = useState<ShareOption>(
|
||||||
shareOptions.find(
|
shareOptions.find(
|
||||||
(option) => option.value === props.transcriptResponse.share_mode,
|
(option) => option.value === props.transcriptResponse.share_mode
|
||||||
) || shareOptions[0],
|
) || shareOptions[0]
|
||||||
);
|
);
|
||||||
const [shareLoading, setShareLoading] = useState(false);
|
const [shareLoading, setShareLoading] = useState(false);
|
||||||
const requireLogin = featureEnabled("requireLogin");
|
const requireLogin = featureEnabled("requireLogin");
|
||||||
@@ -59,12 +59,12 @@ export default function ShareAndPrivacy(props: ShareAndPrivacyProps) {
|
|||||||
|
|
||||||
const updatedTranscript = await api.v1TranscriptUpdate(
|
const updatedTranscript = await api.v1TranscriptUpdate(
|
||||||
props.transcriptResponse.id,
|
props.transcriptResponse.id,
|
||||||
requestBody,
|
requestBody
|
||||||
);
|
);
|
||||||
setShareMode(
|
setShareMode(
|
||||||
shareOptions.find(
|
shareOptions.find(
|
||||||
(option) => option.value === updatedTranscript.share_mode,
|
(option) => option.value === updatedTranscript.share_mode
|
||||||
) || shareOptions[0],
|
) || shareOptions[0]
|
||||||
);
|
);
|
||||||
setShareLoading(false);
|
setShareLoading(false);
|
||||||
};
|
};
|
||||||
@@ -125,20 +125,21 @@ export default function ShareAndPrivacy(props: ShareAndPrivacyProps) {
|
|||||||
<Text size="sm" mb="2" fontWeight={"bold"}>
|
<Text size="sm" mb="2" fontWeight={"bold"}>
|
||||||
Share options
|
Share options
|
||||||
</Text>
|
</Text>
|
||||||
{!requireLogin ||
|
<Flex gap={2} mb={2}>
|
||||||
(shareMode.value !== "private" && (
|
{requireLogin && (
|
||||||
<ShareZulip
|
<ShareZulip
|
||||||
transcriptResponse={props.transcriptResponse}
|
transcriptResponse={props.transcriptResponse}
|
||||||
topicsResponse={props.topicsResponse}
|
topicsResponse={props.topicsResponse}
|
||||||
|
disabled={toShareMode(shareMode.value) === "private"}
|
||||||
/>
|
/>
|
||||||
))}
|
)}
|
||||||
|
<ShareCopy
|
||||||
|
finalSummaryRef={props.finalSummaryRef}
|
||||||
|
transcriptResponse={props.transcriptResponse}
|
||||||
|
topicsResponse={props.topicsResponse}
|
||||||
|
/>
|
||||||
|
</Flex>
|
||||||
|
|
||||||
<ShareCopy
|
|
||||||
finalSummaryRef={props.finalSummaryRef}
|
|
||||||
transcriptResponse={props.transcriptResponse}
|
|
||||||
topicsResponse={props.topicsResponse}
|
|
||||||
mb={2}
|
|
||||||
/>
|
|
||||||
<ShareLink transcriptId={props.transcriptResponse.id} />
|
<ShareLink transcriptId={props.transcriptResponse.id} />
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
|
|||||||
@@ -2,21 +2,27 @@ import { useState } from "react";
|
|||||||
import { featureEnabled } from "../domainContext";
|
import { featureEnabled } from "../domainContext";
|
||||||
import ShareModal from "./[transcriptId]/shareModal";
|
import ShareModal from "./[transcriptId]/shareModal";
|
||||||
import { GetTranscript, GetTranscriptTopic } from "../../api";
|
import { GetTranscript, GetTranscriptTopic } from "../../api";
|
||||||
import { Button } from "@chakra-ui/react";
|
import { BoxProps, Button } from "@chakra-ui/react";
|
||||||
|
|
||||||
type ShareZulipProps = {
|
type ShareZulipProps = {
|
||||||
transcriptResponse: GetTranscript;
|
transcriptResponse: GetTranscript;
|
||||||
topicsResponse: GetTranscriptTopic[];
|
topicsResponse: GetTranscriptTopic[];
|
||||||
|
disabled: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function ShareZulip(props: ShareZulipProps) {
|
export default function ShareZulip(props: ShareZulipProps & BoxProps) {
|
||||||
const [showModal, setShowModal] = useState(false);
|
const [showModal, setShowModal] = useState(false);
|
||||||
if (!featureEnabled("sendToZulip")) return null;
|
if (!featureEnabled("sendToZulip")) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Button colorScheme="blue" onClick={() => setShowModal(true)}>
|
<Button
|
||||||
➡️ Zulip
|
colorScheme="blue"
|
||||||
|
size={"sm"}
|
||||||
|
isDisabled={props.disabled}
|
||||||
|
onClick={() => setShowModal(true)}
|
||||||
|
>
|
||||||
|
➡️ Send to Zulip
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<ShareModal
|
<ShareModal
|
||||||
|
|||||||
Reference in New Issue
Block a user