chore: remove public channel portals

This commit is contained in:
zerosoul
2022-06-13 11:39:03 +08:00
parent 516794d352
commit 89d407f4b0
4 changed files with 18 additions and 14 deletions
+5 -4
View File
@@ -1,5 +1,5 @@
import { useState } from "react";
import { useSelector } from "react-redux";
// import { useSelector } from "react-redux";
import styled from "styled-components";
import { hideAll } from "tippy.js";
import IconInvite from "../../assets/icons/add.person.svg";
@@ -42,7 +42,7 @@ const Styled = styled.ul`
}
`;
export default function AddEntriesMenu() {
const currentUser = useSelector((store) => store.contacts.byId[store.authData.uid]);
// const currentUser = useSelector((store) => store.contacts.byId[store.authData.uid]);
const [isPrivate, setIsPrivate] = useState(false);
const [inviteModalVisible, setInviteModalVisible] = useState(false);
@@ -75,12 +75,13 @@ export default function AddEntriesMenu() {
return (
<>
<Styled>
{currentUser?.is_admin && (
{/* temp remove public channel */}
{/* {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
+10 -10
View File
@@ -7,7 +7,7 @@ import Button from "../styled/Button";
import ChannelIcon from "../ChannelIcon";
import Contact from "../Contact";
import StyledWrapper from "./styled";
import StyledToggle from "../../component/styled/Toggle";
// import StyledToggle from "../../component/styled/Toggle";
import StyledCheckbox from "../../component/styled/Checkbox";
import useFilteredUsers from "../../hook/useFilteredUsers";
@@ -28,12 +28,12 @@ export default function ChannelModal({ 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 = () => {
if (!data.name) {
toast("please input channel name");
@@ -125,7 +125,7 @@ export default function ChannelModal({ personal = false, closeModal }) {
<h3 className="title">Create New Channel</h3>
<p className="desc normal">
{!is_public
? "This is a private channel, only select members will bee able to join."
? "This is a private channel, only select members will be able to join."
: "This is a public channel, everyone in this team can see it."}
</p>
<div className="name">
@@ -135,14 +135,14 @@ export default function ChannelModal({ 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
@@ -57,6 +57,7 @@ const StyledWrapper = styled.div`
box-sizing: border-box;
&.private {
width: 344px;
justify-content: space-evenly;
.desc {
text-align: center;
}
+2
View File
@@ -26,6 +26,8 @@ const StyledToggle = styled.div`
}
}
&[data-disabled="true"] {
cursor: not-allowed;
background-color: #ccc;
pointer-events: none;
}
`;