diff --git a/src/components/Apps/AppsNavBar.tsx b/src/components/Apps/AppsNavBar.tsx
index a5c5c36..3efe977 100644
--- a/src/components/Apps/AppsNavBar.tsx
+++ b/src/components/Apps/AppsNavBar.tsx
@@ -64,7 +64,7 @@ export function saveToLocalStorage(key, subKey, newValue) {
}
}
-export const AppsNavBar = () => {
+export const AppsNavBar = ({appsMode}) => {
const [tabs, setTabs] = useState([]);
const [selectedTab, setSelectedTab] = useState(null);
const [isNewTabWindow, setIsNewTabWindow] = useState(false);
@@ -77,10 +77,11 @@ export const AppsNavBar = () => {
const [navigationController, setNavigationController] = useRecoilState(navigationControllerAtom)
const isDisableBackButton = useMemo(()=> {
+ if(isNewTabWindow && appsMode === 'viewer') return true
if(selectedTab && navigationController[selectedTab?.tabId]?.hasBack) return false
if(selectedTab && !navigationController[selectedTab?.tabId]?.hasBack) return true
return false
- }, [navigationController, selectedTab])
+ }, [navigationController, selectedTab, isNewTabWindow, appsMode])
const setSettingsLocalLastUpdated = useSetRecoilState(
settingsLocalLastUpdatedAtom
diff --git a/src/components/Apps/useQortalMessageListener.tsx b/src/components/Apps/useQortalMessageListener.tsx
index 91c7bde..69089b9 100644
--- a/src/components/Apps/useQortalMessageListener.tsx
+++ b/src/components/Apps/useQortalMessageListener.tsx
@@ -479,7 +479,7 @@ isDOMContentLoaded: false
} else if (
event?.data?.action === 'PUBLISH_MULTIPLE_QDN_RESOURCES' ||
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;
diff --git a/src/components/Embeds/AttachmentEmbed.tsx b/src/components/Embeds/AttachmentEmbed.tsx
index e335e18..0f08cbf 100644
--- a/src/components/Embeds/AttachmentEmbed.tsx
+++ b/src/components/Embeds/AttachmentEmbed.tsx
@@ -28,6 +28,7 @@ import DownloadIcon from "@mui/icons-material/Download";
import SaveIcon from '@mui/icons-material/Save';
import { useSetRecoilState } from "recoil";
import { blobControllerAtom } from "../../atoms/global";
+import { decodeIfEncoded } from "../../utils/decode";
export const AttachmentCard = ({
@@ -206,7 +207,7 @@ export const AttachmentCard = ({
color: "white",
}}
>
- Created by {owner}
+ Created by {decodeIfEncoded(owner)}
{
- if(errorMsg){
- setHeight('300px')
- }
- }, [errorMsg])
+ // useEffect(()=> {
+ // if(errorMsg){
+ // setHeight('300px')
+ // }
+ // }, [errorMsg])
return (
- Created by {owner}
+ Created by {decodeIfEncoded(owner)}
-
+
>
)}
>
diff --git a/src/utils/decode.ts b/src/utils/decode.ts
new file mode 100644
index 0000000..3123810
--- /dev/null
+++ b/src/utils/decode.ts
@@ -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;
+ }
\ No newline at end of file
diff --git a/src/utils/time.ts b/src/utils/time.ts
index 77a0daf..b0a27cf 100644
--- a/src/utils/time.ts
+++ b/src/utils/time.ts
@@ -35,4 +35,22 @@ export function formatTimestamp(timestamp: number): string {
const date = moment(unixTimestamp, 'x').fromNow()
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);
+ }
+ });
}
\ No newline at end of file