mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-04-23 19:37:52 +00:00
fixes
This commit is contained in:
parent
916d1302a4
commit
b314c0a1c4
@ -301,7 +301,6 @@ export const AppsDesktop = ({ mode, setMode, show , myName, goToHome, setDesktop
|
|||||||
};
|
};
|
||||||
}, [tabs]);
|
}, [tabs]);
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppsParent
|
<AppsParent
|
||||||
sx={{
|
sx={{
|
||||||
@ -425,7 +424,7 @@ export const AppsDesktop = ({ mode, setMode, show , myName, goToHome, setDesktop
|
|||||||
</ButtonBase>
|
</ButtonBase>
|
||||||
)}
|
)}
|
||||||
{mode !== 'home' && (
|
{mode !== 'home' && (
|
||||||
<AppsNavBarDesktop />
|
<AppsNavBarDesktop disableBack={isNewTabWindow && mode === 'viewer'} />
|
||||||
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ export function saveToLocalStorage(key, subKey, newValue) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AppsNavBarDesktop = () => {
|
export const AppsNavBarDesktop = ({disableBack}) => {
|
||||||
const [tabs, setTabs] = useState([]);
|
const [tabs, setTabs] = useState([]);
|
||||||
const [selectedTab, setSelectedTab] = useState(null);
|
const [selectedTab, setSelectedTab] = useState(null);
|
||||||
const [navigationController, setNavigationController] = useRecoilState(navigationControllerAtom)
|
const [navigationController, setNavigationController] = useRecoilState(navigationControllerAtom)
|
||||||
@ -107,10 +107,11 @@ export const AppsNavBarDesktop = () => {
|
|||||||
|
|
||||||
|
|
||||||
const isDisableBackButton = useMemo(()=> {
|
const isDisableBackButton = useMemo(()=> {
|
||||||
|
if(disableBack) return true
|
||||||
if(selectedTab && navigationController[selectedTab?.tabId]?.hasBack) return false
|
if(selectedTab && navigationController[selectedTab?.tabId]?.hasBack) return false
|
||||||
if(selectedTab && !navigationController[selectedTab?.tabId]?.hasBack) return true
|
if(selectedTab && !navigationController[selectedTab?.tabId]?.hasBack) return true
|
||||||
return false
|
return false
|
||||||
}, [navigationController, selectedTab])
|
}, [navigationController, selectedTab, disableBack])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -481,7 +481,7 @@ isDOMContentLoaded: false
|
|||||||
} else if (
|
} else if (
|
||||||
event?.data?.action === 'PUBLISH_MULTIPLE_QDN_RESOURCES' ||
|
event?.data?.action === 'PUBLISH_MULTIPLE_QDN_RESOURCES' ||
|
||||||
event?.data?.action === 'PUBLISH_QDN_RESOURCE' ||
|
event?.data?.action === 'PUBLISH_QDN_RESOURCE' ||
|
||||||
event?.data?.action === 'ENCRYPT_DATA' || event?.data?.action === 'ENCRYPT_DATA_WITH_SHARING_KEY' || 'ENCRYPT_QORTAL_GROUP_DATA'
|
event?.data?.action === 'ENCRYPT_DATA' || event?.data?.action === 'ENCRYPT_DATA_WITH_SHARING_KEY' || event?.data?.action === 'ENCRYPT_QORTAL_GROUP_DATA'
|
||||||
|
|
||||||
) {
|
) {
|
||||||
let data;
|
let data;
|
||||||
|
@ -28,6 +28,7 @@ import DownloadIcon from "@mui/icons-material/Download";
|
|||||||
import SaveIcon from '@mui/icons-material/Save';
|
import SaveIcon from '@mui/icons-material/Save';
|
||||||
import { useSetRecoilState } from "recoil";
|
import { useSetRecoilState } from "recoil";
|
||||||
import { blobControllerAtom } from "../../atoms/global";
|
import { blobControllerAtom } from "../../atoms/global";
|
||||||
|
import { decodeIfEncoded } from "../../utils/decode";
|
||||||
|
|
||||||
|
|
||||||
export const AttachmentCard = ({
|
export const AttachmentCard = ({
|
||||||
@ -181,7 +182,7 @@ export const AttachmentCard = ({
|
|||||||
color: "white",
|
color: "white",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Created by {owner}
|
Created by {decodeIfEncoded(owner)}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography
|
<Typography
|
||||||
sx={{
|
sx={{
|
||||||
|
@ -14,6 +14,7 @@ import { parseQortalLink } from "./embed-utils";
|
|||||||
import { PollCard } from "./PollEmbed";
|
import { PollCard } from "./PollEmbed";
|
||||||
import { ImageCard } from "./ImageEmbed";
|
import { ImageCard } from "./ImageEmbed";
|
||||||
import { AttachmentCard } from "./AttachmentEmbed";
|
import { AttachmentCard } from "./AttachmentEmbed";
|
||||||
|
import { decodeIfEncoded } from "../../utils/decode";
|
||||||
|
|
||||||
const getPoll = async (name) => {
|
const getPoll = async (name) => {
|
||||||
const pollName = name;
|
const pollName = name;
|
||||||
|
@ -17,6 +17,7 @@ import OpenInNewIcon from "@mui/icons-material/OpenInNew";
|
|||||||
import { CustomLoader } from "../../common/CustomLoader";
|
import { CustomLoader } from "../../common/CustomLoader";
|
||||||
import ImageIcon from "@mui/icons-material/Image";
|
import ImageIcon from "@mui/icons-material/Image";
|
||||||
import CloseIcon from "@mui/icons-material/Close";
|
import CloseIcon from "@mui/icons-material/Close";
|
||||||
|
import { decodeIfEncoded } from "../../utils/decode";
|
||||||
|
|
||||||
export const ImageCard = ({
|
export const ImageCard = ({
|
||||||
image,
|
image,
|
||||||
@ -37,11 +38,11 @@ export const ImageCard = ({
|
|||||||
}
|
}
|
||||||
}, [isOpen]);
|
}, [isOpen]);
|
||||||
|
|
||||||
useEffect(()=> {
|
// useEffect(()=> {
|
||||||
if(errorMsg){
|
// if(errorMsg){
|
||||||
setHeight('300px')
|
// setHeight('300px')
|
||||||
}
|
// }
|
||||||
}, [errorMsg])
|
// }, [errorMsg])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
@ -113,7 +114,7 @@ export const ImageCard = ({
|
|||||||
color: "white",
|
color: "white",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Created by {owner}
|
Created by {decodeIfEncoded(owner)}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography
|
<Typography
|
||||||
sx={{
|
sx={{
|
||||||
|
@ -99,6 +99,7 @@ import { formatEmailDate } from "./QMailMessages";
|
|||||||
import { AdminSpace } from "../Chat/AdminSpace";
|
import { AdminSpace } from "../Chat/AdminSpace";
|
||||||
import { useSetRecoilState } from "recoil";
|
import { useSetRecoilState } from "recoil";
|
||||||
import { selectedGroupIdAtom } from "../../atoms/global";
|
import { selectedGroupIdAtom } from "../../atoms/global";
|
||||||
|
import { sortArrayByTimestampAndGroupName } from "../../utils/time";
|
||||||
|
|
||||||
// let touchStartY = 0;
|
// let touchStartY = 0;
|
||||||
// let disablePullToRefresh = false;
|
// let disablePullToRefresh = false;
|
||||||
@ -121,6 +122,13 @@ import { selectedGroupIdAtom } from "../../atoms/global";
|
|||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
|
|
||||||
|
const isWithinLast15Minutes = (timestamp) => {
|
||||||
|
const now = Date.now(); // Current timestamp in milliseconds
|
||||||
|
const fifteenMinutes = 15 * 60 * 1000; // 15 minutes in milliseconds
|
||||||
|
|
||||||
|
return now - timestamp < fifteenMinutes;
|
||||||
|
};
|
||||||
|
|
||||||
export const getPublishesFromAdmins = async (admins: string[], groupId) => {
|
export const getPublishesFromAdmins = async (admins: string[], groupId) => {
|
||||||
// const validApi = await findUsableApi();
|
// const validApi = await findUsableApi();
|
||||||
const queryString = admins.map((name) => `name=${name}`).join("&");
|
const queryString = admins.map((name) => `name=${name}`).join("&");
|
||||||
@ -909,7 +917,7 @@ export const Group = ({
|
|||||||
if (message?.action === "SET_GROUPS") {
|
if (message?.action === "SET_GROUPS") {
|
||||||
|
|
||||||
// Update the component state with the received 'sendqort' state
|
// Update the component state with the received 'sendqort' state
|
||||||
setGroups(message.payload);
|
setGroups(sortArrayByTimestampAndGroupName(message.payload));
|
||||||
getLatestRegularChat(message.payload);
|
getLatestRegularChat(message.payload);
|
||||||
setMemberGroups(message.payload);
|
setMemberGroups(message.payload);
|
||||||
|
|
||||||
|
16
src/utils/decode.ts
Normal file
16
src/utils/decode.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
export function decodeIfEncoded(input) {
|
||||||
|
try {
|
||||||
|
// Check if input is URI-encoded by encoding and decoding
|
||||||
|
const encoded = encodeURIComponent(decodeURIComponent(input));
|
||||||
|
if (encoded === input) {
|
||||||
|
// Input is URI-encoded, so decode it
|
||||||
|
return decodeURIComponent(input);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// decodeURIComponent throws an error if input is not encoded
|
||||||
|
console.error("Error decoding URI:", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return input as-is if not URI-encoded
|
||||||
|
return input;
|
||||||
|
}
|
@ -35,4 +35,22 @@ export function formatTimestamp(timestamp: number): string {
|
|||||||
const date = moment(unixTimestamp, 'x').fromNow()
|
const date = moment(unixTimestamp, 'x').fromNow()
|
||||||
|
|
||||||
return date
|
return date
|
||||||
|
}
|
||||||
|
|
||||||
|
export function sortArrayByTimestampAndGroupName(array) {
|
||||||
|
return array.sort((a, b) => {
|
||||||
|
if (a.timestamp && b.timestamp) {
|
||||||
|
// Both have timestamp, sort by timestamp descending
|
||||||
|
return b.timestamp - a.timestamp;
|
||||||
|
} else if (a.timestamp) {
|
||||||
|
// Only `a` has timestamp, it comes first
|
||||||
|
return -1;
|
||||||
|
} else if (b.timestamp) {
|
||||||
|
// Only `b` has timestamp, it comes first
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
// Neither has timestamp, sort alphabetically by groupName
|
||||||
|
return a.groupName.localeCompare(b.groupName);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user