Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/resolve stage conflicts 3 #2903

Merged
merged 17 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
e69736b
Enhancment/Grant app permissions to new system roles (#2863)
agalin920 Jul 22, 2024
7398833
[Content] Do not show edit template for datasets (#2870)
finnar-bin Jul 23, 2024
8d30954
Schema rules limit file type for media field (#2867)
agalin920 Jul 23, 2024
4d91e56
[Content] Do not show the model as a breadcrumb item when in multipag…
finnar-bin Jul 23, 2024
dc88b71
Fix/table sort by display date field by accounting for empty date val…
agalin920 Jul 23, 2024
b9acd99
Reference createdAt timestamp outside of history object (#2868)
agalin920 Jul 24, 2024
1727581
[Schema | Content] Currency field revamp (#2873)
finnar-bin Jul 25, 2024
bae5cea
[Schema] Currency field vqa updates (#2883)
finnar-bin Jul 26, 2024
8c0f3ac
vqa fixes media schema rules (#2890)
agalin920 Jul 29, 2024
88613eb
[Content] Show image placeholder in publish modal dialog (#2888)
finnar-bin Jul 30, 2024
f3271c2
Hide publish based on permissions on code app (#2887)
agalin920 Jul 30, 2024
361736c
[Content] Do not store pinned columns to local storage (#2892)
finnar-bin Jul 30, 2024
b88aa66
[Content] Multipage table advanced sorting (#2884)
finnar-bin Jul 31, 2024
d49cc5f
[Content] Filter button icon update & show api endpoints on hover (#2…
finnar-bin Jul 31, 2024
379c957
[Content] Only show publish actions when dropdown selection has chang…
finnar-bin Jul 31, 2024
21fc276
[Media] File replacement (#2849)
finnar-bin Aug 1, 2024
43e6eb3
Merge branch 'stage' into chore/resolve-stage-conflicts-3
finnar-bin Aug 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"@tinymce/tinymce-react": "^4.3.0",
"@welldone-software/why-did-you-render": "^6.1.1",
"@zesty-io/core": "1.10.0",
"@zesty-io/material": "^0.15.2",
"@zesty-io/material": "^0.15.3",
"chart.js": "^3.8.0",
"chartjs-adapter-moment": "^1.0.1",
"chartjs-plugin-datalabels": "^2.0.0",
Expand Down
89 changes: 89 additions & 0 deletions src/apps/content-editor/src/app/components/APIEndpoints.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import { useSelector } from "react-redux";
import { useParams } from "react-router";
import {
MenuList,
MenuItem,
ListItemIcon,
Typography,
Chip,
} from "@mui/material";
import { DesignServicesRounded, VisibilityRounded } from "@mui/icons-material";

import { AppState } from "../../../../../shell/store/types";
import { ContentItem } from "../../../../../shell/services/types";
import { useGetDomainsQuery } from "../../../../../shell/services/accounts";
import { ApiType } from "../../../../schema/src/app/components/ModelApi";

type APIEndpointsProps = {
type: Extract<ApiType, "quick-access" | "site-generators">;
};
export const APIEndpoints = ({ type }: APIEndpointsProps) => {
const { itemZUID } = useParams<{
itemZUID: string;
}>();
const item = useSelector(
(state: AppState) => state.content[itemZUID] as ContentItem
);
const instance = useSelector((state: AppState) => state.instance);
const { data: domains } = useGetDomainsQuery();

const apiTypeEndpointMap: Partial<Record<ApiType, string>> = {
"quick-access": `/-/instant/${itemZUID}.json`,
"site-generators": item ? `/${item?.web?.path}/?toJSON` : "/?toJSON",
};

const liveDomain = domains?.find((domain) => domain.branch == "live");

return (
<MenuList>
<MenuItem
onClick={() => {
window.open(
// @ts-expect-error config not typed
`${CONFIG.URL_PREVIEW_PROTOCOL}${instance.randomHashID}${CONFIG.URL_PREVIEW}${apiTypeEndpointMap[type]}`,
"_blank"
);
}}
>
<ListItemIcon>
<DesignServicesRounded />
</ListItemIcon>
<Typography
variant="inherit"
noWrap
sx={{
width: 172,
}}
>
{/* @ts-expect-error config not typed */}
{`${instance.randomHashID}${CONFIG.URL_PREVIEW}${apiTypeEndpointMap[type]}`}
</Typography>
<Chip size="small" label="Dev" />
</MenuItem>
{liveDomain && (
<MenuItem
onClick={() => {
window.open(
`https://${liveDomain.domain}${apiTypeEndpointMap[type]}`,
"_blank"
);
}}
>
<ListItemIcon>
<VisibilityRounded />
</ListItemIcon>
<Typography
variant="inherit"
noWrap
sx={{
width: 172,
}}
>
{`${liveDomain.domain}${apiTypeEndpointMap[type]}`}
</Typography>
<Chip size="small" label="Prod" />
</MenuItem>
)}
</MenuList>
);
};
27 changes: 25 additions & 2 deletions src/apps/content-editor/src/app/components/FieldTypeMedia.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
} from "@mui/icons-material";
import { alpha } from "@mui/material/styles";
import { CompactView, Modal, Login } from "@bynder/compact-view";
import { Bynder } from "@zesty-io/material";
import { Bynder, FileReplace } from "@zesty-io/material";

import {
useGetBinsQuery,
Expand All @@ -43,6 +43,8 @@ import styles from "../../../../media/src/app/components/Thumbnail/Loading.less"
import cx from "classnames";
import { FileTypePreview } from "../../../../media/src/app/components/FileModal/FileTypePreview";
import { useGetInstanceSettingsQuery } from "../../../../../shell/services/instance";
import { ReplaceFileModal } from "../../../../media/src/app/components/FileModal/ReplaceFileModal";
import { showReportDialog } from "@sentry/react";

type FieldTypeMediaProps = {
images: string[];
Expand Down Expand Up @@ -597,6 +599,7 @@ const MediaItem = ({
skip: imageZUID?.substr(0, 4) === "http",
});
const [showRenameFileModal, setShowRenameFileModal] = useState(false);
const [isReplaceFileModalOpen, setIsReplaceFileModalOpen] = useState(false);
const [isCopied, setIsCopied] = useState(false);
const [isCopiedZuid, setIsCopiedZuid] = useState(false);
const [newFilename, setNewFilename] = useState("");
Expand Down Expand Up @@ -757,6 +760,7 @@ const MediaItem = ({
<FileTypePreview
src={isURL ? imageZUID : data?.url}
filename={isURL ? imageZUID : data?.filename}
updatedAt={data?.updated_at}
isMediaThumbnail
/>
)}
Expand Down Expand Up @@ -794,7 +798,7 @@ const MediaItem = ({
)}
<Box display="flex" gap={1} justifyContent="flex-end">
{!isBynderAsset || (isBynderAsset && isBynderSessionValid) ? (
<Tooltip title="Replace File" placement="bottom" enterDelay={800}>
<Tooltip title="Swap File" placement="bottom" enterDelay={800}>
<IconButton
size="small"
onClick={(event: any) => {
Expand Down Expand Up @@ -861,6 +865,18 @@ const MediaItem = ({
<ListItemText>Rename</ListItemText>
</MenuItem>
)}
<MenuItem
onClick={(event) => {
event.stopPropagation();
setAnchorEl(null);
setIsReplaceFileModalOpen(true);
}}
>
<ListItemIcon>
<FileReplace />
</ListItemIcon>
<ListItemText>Replace File</ListItemText>
</MenuItem>
{!isURL && !isBynderAsset && (
<MenuItem
onClick={(event) => {
Expand Down Expand Up @@ -914,6 +930,13 @@ const MediaItem = ({
extension={fileExtension(data.filename)}
/>
)}
{isReplaceFileModalOpen && (
<ReplaceFileModal
originalFile={data}
onClose={() => setIsReplaceFileModalOpen(false)}
onCancel={() => setIsReplaceFileModalOpen(false)}
/>
)}
</>
);
};
Loading