feat: recover public channel
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { useState } from "react";
|
||||
import styled from "styled-components";
|
||||
import { hideAll } from "tippy.js";
|
||||
import { useAppSelector } from "../../app/store";
|
||||
import IconInvite from "../../assets/icons/add.person.svg";
|
||||
import IconMention from "../../assets/icons/mention.svg";
|
||||
import ChannelIcon from "./ChannelIcon";
|
||||
@@ -41,6 +42,7 @@ const Styled = styled.ul`
|
||||
}
|
||||
`;
|
||||
export default function AddEntriesMenu() {
|
||||
const currentUser = useAppSelector((store) => store.authData.user);
|
||||
const [isPrivate, setIsPrivate] = useState(false);
|
||||
const [inviteModalVisible, setInviteModalVisible] = useState(false);
|
||||
|
||||
@@ -74,12 +76,12 @@ export default function AddEntriesMenu() {
|
||||
<>
|
||||
<Styled>
|
||||
{/* temp remove public channel */}
|
||||
{/* {currentUser?.is_admin && (
|
||||
{currentUser?.is_admin && (
|
||||
<li className="item" onClick={handleOpenChannelModal.bind(null, false)}>
|
||||
<ChannelIcon className="icon" />
|
||||
New Channel
|
||||
</li>
|
||||
)} */}
|
||||
)}
|
||||
<li className="item" onClick={handleOpenChannelModal.bind(null, true)}>
|
||||
<ChannelIcon personal={true} className="icon" />
|
||||
New Private Channel
|
||||
|
||||
@@ -7,6 +7,7 @@ import ChannelIcon from "../ChannelIcon";
|
||||
import Contact from "../Contact";
|
||||
import StyledWrapper from "./styled";
|
||||
import StyledCheckbox from "../styled/Checkbox";
|
||||
import StyledToggle from "../../component/styled/Toggle";
|
||||
import useFilteredUsers from "../../hook/useFilteredUsers";
|
||||
import { useCreateChannelMutation } from "../../../app/services/channel";
|
||||
import { useAppSelector } from "../../../app/store";
|
||||
@@ -33,12 +34,12 @@ const ChannelModal: FC<Props> = ({ personal = false, closeModal }) => {
|
||||
const [createChannel, { isSuccess, isError, isLoading, data: newChannelId }] =
|
||||
useCreateChannelMutation();
|
||||
|
||||
// const handleToggle = () => {
|
||||
// const { is_public } = data;
|
||||
// setData((prev) => {
|
||||
// return { ...prev, is_public: !is_public };
|
||||
// });
|
||||
// };
|
||||
const handleToggle = () => {
|
||||
const { is_public } = data;
|
||||
setData((prev) => {
|
||||
return { ...prev, is_public: !is_public };
|
||||
});
|
||||
};
|
||||
const handleCreate = () => {
|
||||
// todo: add field validation (maxLength, text format, trim)
|
||||
if (!data.name) {
|
||||
@@ -141,14 +142,14 @@ const ChannelModal: FC<Props> = ({ personal = false, closeModal }) => {
|
||||
<ChannelIcon personal={!is_public} className="icon" />
|
||||
</div>
|
||||
</div>
|
||||
{/* <div className="private">
|
||||
<div className="private">
|
||||
<span className="txt normal">Private Channel</span>
|
||||
<StyledToggle
|
||||
data-checked={!is_public}
|
||||
data-disabled={!loginUser?.is_admin}
|
||||
onClick={handleToggle}
|
||||
/>
|
||||
</div> */}
|
||||
</div>
|
||||
<div className="btns">
|
||||
<Button onClick={closeModal} className="normal cancel">
|
||||
Cancel
|
||||
|
||||
Reference in New Issue
Block a user