chore: fixes
This commit is contained in:
@@ -50,7 +50,14 @@ const uiSlice = createSlice({
|
|||||||
initialState,
|
initialState,
|
||||||
reducers: {
|
reducers: {
|
||||||
fillUI(state, action: PayloadAction<Partial<UIState>>) {
|
fillUI(state, action: PayloadAction<Partial<UIState>>) {
|
||||||
const { SSEStatus, ready, online, msgSound = false, ...rest } = action.payload;
|
const {
|
||||||
|
SSEStatus,
|
||||||
|
ready,
|
||||||
|
online,
|
||||||
|
msgSound = false,
|
||||||
|
fileListView = "item",
|
||||||
|
...rest
|
||||||
|
} = action.payload;
|
||||||
window.MSG_SOUND = msgSound;
|
window.MSG_SOUND = msgSound;
|
||||||
return { ...state, msgSound, ...rest };
|
return { ...state, msgSound, ...rest };
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import {
|
|||||||
VideoPreview
|
VideoPreview
|
||||||
} from "./preview";
|
} from "./preview";
|
||||||
import { shallowEqual } from "react-redux";
|
import { shallowEqual } from "react-redux";
|
||||||
|
import DownloadArea from "../FileMessage/DownloadArea";
|
||||||
|
|
||||||
interface Data {
|
interface Data {
|
||||||
file_type: string;
|
file_type: string;
|
||||||
@@ -135,13 +136,7 @@ const FileBox: FC<Props> = ({
|
|||||||
</span>
|
</span>
|
||||||
</em>
|
</em>
|
||||||
</div>
|
</div>
|
||||||
<a
|
<DownloadArea copyLink={content} downloadLink={`${content}&download=true`} />
|
||||||
className="hidden md:block whitespace-nowrap"
|
|
||||||
download={name}
|
|
||||||
href={`${content}&download=true`}
|
|
||||||
>
|
|
||||||
<IconDownload className="fill-gray-500 dark:fill-gray-300" />
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
{withPreview && <div className="h-[calc(100%_-_64px)] overflow-hidden">{previewContent}</div>}
|
{withPreview && <div className="h-[calc(100%_-_64px)] overflow-hidden">{previewContent}</div>}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ type Props = {
|
|||||||
const DownloadArea = ({ copyLink, downloadLink }: Props) => {
|
const DownloadArea = ({ copyLink, downloadLink }: Props) => {
|
||||||
const { copy, copied } = useCopy();
|
const { copy, copied } = useCopy();
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col-reverse gap-2 items-center">
|
<div className="flex flex-col-reverse gap-1.5 items-center">
|
||||||
<button
|
<button
|
||||||
className="hidden md:block whitespace-nowrap"
|
className="hidden md:block whitespace-nowrap"
|
||||||
disabled={copied}
|
disabled={copied}
|
||||||
|
|||||||
@@ -79,7 +79,10 @@ export default function useMessageOperation({ mid, context, contextId }: Params)
|
|||||||
loginUser?.uid == from_uid ||
|
loginUser?.uid == from_uid ||
|
||||||
loginUser?.is_admin ||
|
loginUser?.is_admin ||
|
||||||
(channel && channel.owner == loginUser?.uid);
|
(channel && channel.owner == loginUser?.uid);
|
||||||
const canCopy = [ContentTypes.text, ContentTypes.markdown].includes(content_type) || isImage;
|
const canCopy =
|
||||||
|
[ContentTypes.text, ContentTypes.markdown, ContentTypes.audio, ContentTypes.file].includes(
|
||||||
|
content_type
|
||||||
|
) || isImage;
|
||||||
return {
|
return {
|
||||||
copyContent: isImage ? copyContent.bind(null, true) : copyContent.bind(null, false),
|
copyContent: isImage ? copyContent.bind(null, true) : copyContent.bind(null, false),
|
||||||
canCopy,
|
canCopy,
|
||||||
|
|||||||
@@ -31,12 +31,14 @@ const Channel: FC<Props> = ({ select = 0, updateFilter }) => {
|
|||||||
return (
|
return (
|
||||||
<li
|
<li
|
||||||
key={gid}
|
key={gid}
|
||||||
className="relative cursor-pointer flex items-center gap-2"
|
className="relative cursor-pointer flex items-center gap-2 justify-between"
|
||||||
onClick={handleClick.bind(null, gid)}
|
onClick={handleClick.bind(null, gid)}
|
||||||
>
|
>
|
||||||
<ChannelIcon personal={!is_public} />
|
<ChannelIcon personal={!is_public} />
|
||||||
<span className="text-gray-500 dark:text-gray-100 font-semibold text-sm">{name}</span>
|
<span className="text-gray-500 dark:text-gray-100 font-semibold text-sm flex-1">
|
||||||
{select == gid && <CheckSign className="absolute right-0 top-1/2 -translate-y-1/2" />}
|
{name}
|
||||||
|
</span>
|
||||||
|
{select == gid && <CheckSign className="" />}
|
||||||
</li>
|
</li>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -30,11 +30,13 @@ const From: FC<Props> = ({ select = "", updateFilter }) => {
|
|||||||
</li>
|
</li>
|
||||||
{users.map(({ uid }) => {
|
{users.map(({ uid }) => {
|
||||||
return (
|
return (
|
||||||
<li key={uid} className="relative cursor-pointer" onClick={handleClick.bind(null, uid)}>
|
<li
|
||||||
|
key={uid}
|
||||||
|
className="relative flex items-center gap-2 justify-between cursor-pointer"
|
||||||
|
onClick={handleClick.bind(null, uid)}
|
||||||
|
>
|
||||||
<User uid={uid} interactive={true} />
|
<User uid={uid} interactive={true} />
|
||||||
{select == uid && (
|
{select == uid && <CheckSign className="" />}
|
||||||
<CheckSign className="absolute right-1.5 top-1/2 -translate-y-1/2" />
|
|
||||||
)}
|
|
||||||
</li>
|
</li>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ function Files() {
|
|||||||
const [getFiles, { data }] = useLazyGetFilesQuery();
|
const [getFiles, { data }] = useLazyGetFilesQuery();
|
||||||
const listContainerRef = useRef<HTMLDivElement>();
|
const listContainerRef = useRef<HTMLDivElement>();
|
||||||
const [filter, setFilter] = useState({});
|
const [filter, setFilter] = useState({});
|
||||||
const view = useAppSelector((store) => store.ui.fileListView.view, shallowEqual);
|
const view = useAppSelector((store) => store.ui.fileListView, shallowEqual);
|
||||||
|
|
||||||
const updateFilter = (data) => {
|
const updateFilter = (data) => {
|
||||||
setFilter((prev) => {
|
setFilter((prev) => {
|
||||||
@@ -55,7 +55,7 @@ function Files() {
|
|||||||
if (!data) return null;
|
if (!data) return null;
|
||||||
// return null;
|
// return null;
|
||||||
const nonExpiredFiles = data.filter((item) => !item.expired);
|
const nonExpiredFiles = data.filter((item) => !item.expired);
|
||||||
console.log("nonExpiredFiles", nonExpiredFiles);
|
console.log({ view });
|
||||||
return (
|
return (
|
||||||
<div className="h-screen md:overflow-y-scroll flex flex-col items-start my-2 mr-6 rounded-2xl bg-white dark:bg-gray-700">
|
<div className="h-screen md:overflow-y-scroll flex flex-col items-start my-2 mr-6 rounded-2xl bg-white dark:bg-gray-700">
|
||||||
<Search value={filter.name} updateSearchValue={handleUpdateSearch} />
|
<Search value={filter.name} updateSearchValue={handleUpdateSearch} />
|
||||||
|
|||||||
@@ -35,12 +35,14 @@ const Channel: FC<Props> = ({ select = 0, updateFilter }) => {
|
|||||||
return (
|
return (
|
||||||
<li
|
<li
|
||||||
key={gid}
|
key={gid}
|
||||||
className="relative cursor-pointer flex items-center gap-2"
|
className="cursor-pointer flex items-center gap-2 justify-between"
|
||||||
onClick={handleClick.bind(null, gid)}
|
onClick={handleClick.bind(null, gid)}
|
||||||
>
|
>
|
||||||
<ChannelIcon personal={!is_public} />
|
<ChannelIcon personal={!is_public} />
|
||||||
<span className="text-gray-500 dark:text-gray-100 font-semibold text-sm">{name}</span>
|
<span className="text-gray-500 dark:text-gray-100 font-semibold text-sm flex-1">
|
||||||
{select == gid && <CheckSign className="absolute right-0 top-1/2 -translate-y-1/2" />}
|
{name}
|
||||||
|
</span>
|
||||||
|
{select == gid && <CheckSign className="" />}
|
||||||
</li>
|
</li>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -30,11 +30,13 @@ const From: FC<Props> = ({ select = "", updateFilter }) => {
|
|||||||
</li>
|
</li>
|
||||||
{users.map(({ uid }) => {
|
{users.map(({ uid }) => {
|
||||||
return (
|
return (
|
||||||
<li key={uid} className="relative cursor-pointer" onClick={handleClick.bind(null, uid)}>
|
<li
|
||||||
|
key={uid}
|
||||||
|
className="relative flex items-center gap-2 justify-between cursor-pointer"
|
||||||
|
onClick={handleClick.bind(null, uid)}
|
||||||
|
>
|
||||||
<User uid={uid} interactive={true} />
|
<User uid={uid} interactive={true} />
|
||||||
{select == uid && (
|
{select == uid && <CheckSign className="" />}
|
||||||
<CheckSign className="absolute right-1.5 top-1/2 -translate-y-1/2" />
|
|
||||||
)}
|
|
||||||
</li>
|
</li>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
Reference in New Issue
Block a user