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

V3 export import #3

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions admin/custom.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
declare module '@strapi/design-system/*';
declare module '@strapi/design-system';
// declare module '@strapi/design-system/*';
// declare module '@strapi/design-system';
11 changes: 8 additions & 3 deletions admin/src/components/About/About.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@ const About = () => {
<Box>
<Flex direction="column" alignItems="start" gap={4}>
<Flex direction="column" alignItems="start" gap={2}>
<Typography variant="delta">Strapi 5 Version</Typography>
<Typography variant="delta">Strapi 5 Versions</Typography>
<Typography variant="epsilon">V3 Format</Typography>
<Typography>
{i18n({
id: 'plugin.page.about.strapi5.description',
defaultMessage: 'This is a fork of the original Strapi 4 plugin, converted to Strapi 5.'
id: 'plugin.page.about.strapi5.v3.description',
defaultMessage: 'Complete rewrite focusing on draft/published content and better relation handling.'
})}
</Typography>
<Link href="https://github.com/Moonlight63/strapi-import-export" isExternal>
GitHub (V3 Fork)
</Link>
<Typography variant="epsilon" marginTop={2}>Original Strapi 5 Port</Typography>
<Flex direction="row" gap={4}>
<Link href="https://github.com/Prototypr/strapi-import-export" isExternal>
GitHub (Strapi 5)
Expand Down
49 changes: 49 additions & 0 deletions admin/src/components/BulkExportModal/BulkExportModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { Download } from '@strapi/icons';
import {
useQueryParams,
} from '@strapi/admin/strapi-admin';
import { Modal } from '@strapi/design-system';

import React from 'react';
import { useI18n } from '../../hooks/useI18n';
import { buildValidParams } from '@strapi/content-manager/strapi-admin';

import type { BulkActionComponent } from '@strapi/content-manager/strapi-admin';
import { ExportModalContent, ExportModalFooter, useExportModal } from '../ExportModal/ExportModal';

const ExportAction: BulkActionComponent = ({ documents, model, collectionType }) => {
const { i18n } = useI18n();
const [{ query }] = useQueryParams<{ plugins?: { i18n?: { locale?: string } } }>();
const params = React.useMemo(() => buildValidParams(query), [query]);
const documentIds = documents.map(({ documentId }) => documentId);


const state = useExportModal({ unavailableOptions: ['exportPluginsContentTypes'], documentIds });

return {
variant: 'default',
label: i18n('plugin.cta.export', 'Export'),
icon: <Download />,
onClick: () => {
state.resetOptions();
console.log('onClick');
console.log('collectionType', collectionType);
console.log('model', model);
console.log('documents', documents);
console.log('documentIds', documentIds);
},
dialog: {
type: 'modal',
title: i18n('plugin.cta.export', 'Export'),
content: <ExportModalContent state={state} />,
footer:
<Modal.Footer>
<ExportModalFooter state={state} />
</Modal.Footer>
},
};
};

const BULK_ACTIONS: BulkActionComponent[] = [ExportAction];

export { BULK_ACTIONS };
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,32 @@ import './style.css';
import React, { useEffect, useState } from 'react';
import CodeMirror from "@uiw/react-codemirror";

export const Editor = ({ content = '', language = 'csv', readOnly = false, onChange, style }) => {
import { ReactCodeMirrorProps } from '@uiw/react-codemirror';

export const Editor = ({
content = '',
language = 'json',
readOnly = false,
onChange,
style
}: {
content?: string | object;
language?: string;
readOnly?: boolean;
onChange?: ReactCodeMirrorProps['onChange'];
style?: React.CSSProperties;
}) => {

const [codeMirrorContent, setCodeMirrorContent] = useState('');

useEffect(() => {
console.log('content', content);
if (typeof content === 'object') {
setCodeMirrorContent(content.data);
if((content as unknown as {data: string}).data){
setCodeMirrorContent((content as unknown as {data: string}).data);
}else{
setCodeMirrorContent(JSON.stringify(content, null, 2));
}
}else{
setCodeMirrorContent(content);
}
Expand All @@ -21,8 +39,7 @@ export const Editor = ({ content = '', language = 'csv', readOnly = false, onCha
<>
<CodeMirror
className="plugin-ie-editor"
mode= {{ name: "javascript", json: true }}
lineNumbers={true}
basicSetup={{lineNumbers: true}}
readOnly={false}
style={style}
height="40vh"
Expand Down
239 changes: 0 additions & 239 deletions admin/src/components/ExportModal/ExportModal.jsx

This file was deleted.

Loading