-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(strapi): upgraded strapi support for v5
* Updated [project structure for v5 support](https://docs.strapi.io/dev-docs/plugins/development/plugin-structure) * Updated admin interface to utilize new design system and deprecate helper plugin
- Loading branch information
1 parent
9206a8b
commit 771b760
Showing
37 changed files
with
4,869 additions
and
6,386 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,138 @@ | ||
# Don't check auto-generated stuff into git | ||
coverage | ||
node_modules | ||
stats.json | ||
package-lock.json | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
############################ | ||
# OS X | ||
############################ | ||
|
||
# Cruft | ||
.DS_Store | ||
npm-debug.log | ||
.AppleDouble | ||
.LSOverride | ||
Icon | ||
.Spotlight-V100 | ||
.Trashes | ||
._* | ||
|
||
|
||
############################ | ||
# Linux | ||
############################ | ||
|
||
*~ | ||
|
||
|
||
############################ | ||
# Windows | ||
############################ | ||
|
||
Thumbs.db | ||
ehthumbs.db | ||
Desktop.ini | ||
$RECYCLE.BIN/ | ||
*.cab | ||
*.msi | ||
*.msm | ||
*.msp | ||
|
||
|
||
############################ | ||
# Packages | ||
############################ | ||
|
||
*.7z | ||
*.csv | ||
*.dat | ||
*.dmg | ||
*.gz | ||
*.iso | ||
*.jar | ||
*.rar | ||
*.tar | ||
*.zip | ||
*.com | ||
*.class | ||
*.dll | ||
*.exe | ||
*.o | ||
*.seed | ||
*.so | ||
*.swo | ||
*.swp | ||
*.swn | ||
*.swm | ||
*.out | ||
*.pid | ||
|
||
|
||
############################ | ||
# Logs and databases | ||
############################ | ||
|
||
.tmp | ||
*.log | ||
*.sql | ||
*.sqlite | ||
*.sqlite3 | ||
|
||
|
||
############################ | ||
# Misc. | ||
############################ | ||
|
||
*# | ||
ssl | ||
.idea | ||
dist/ | ||
nbproject | ||
.tsbuildinfo | ||
.eslintcache | ||
.env | ||
|
||
|
||
############################ | ||
# Strapi | ||
############################ | ||
|
||
public/uploads/* | ||
!public/uploads/.gitkeep | ||
|
||
|
||
############################ | ||
# Build | ||
############################ | ||
|
||
dist | ||
build | ||
|
||
|
||
############################ | ||
# Node.js | ||
############################ | ||
|
||
lib-cov | ||
lcov.info | ||
pids | ||
logs | ||
results | ||
node_modules | ||
.node_history | ||
|
||
|
||
############################ | ||
# Package managers | ||
############################ | ||
|
||
.yarn/* | ||
!.yarn/cache | ||
!.yarn/unplugged | ||
!.yarn/patches | ||
!.yarn/releases | ||
!.yarn/sdks | ||
!.yarn/versions | ||
.pnp.* | ||
yarn-error.log | ||
|
||
|
||
############################ | ||
# Tests | ||
############################ | ||
|
||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
declare module '@strapi/design-system/*'; | ||
declare module '@strapi/design-system'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import {FC as FunctionComponent} from 'react'; | ||
|
||
import {useStrapiApp} from '@strapi/admin/strapi-admin'; | ||
import type {Schema} from '@strapi/types'; | ||
|
||
|
||
const prefixFileUrlWithBackendUrl = (fileURL: string) => { | ||
return !!fileURL && | ||
fileURL.startsWith('/') && | ||
'strapi' in window && | ||
window.strapi instanceof Object && | ||
'backendURL' in window.strapi && | ||
window.strapi.backendURL ? | ||
`${window.strapi.backendURL}${fileURL}` : | ||
fileURL; | ||
}; | ||
|
||
interface MediaLibComponentProps { | ||
isOpen: boolean, | ||
onChange: (files: Schema.Attribute.MediaValue<true>) => void, | ||
onToggle: () => void, | ||
} | ||
|
||
const MediaLib: FunctionComponent<MediaLibComponentProps> = ({ | ||
isOpen, | ||
onChange, | ||
onToggle, | ||
}) => { | ||
const components = useStrapiApp('ImageDialog', (state) => state.components); | ||
if (!components || !isOpen) return null; | ||
|
||
const MediaLibraryDialog = components['media-library'] as FunctionComponent<{ | ||
onClose: () => void, | ||
onSelectAssets: (_images: Schema.Attribute.MediaValue<true>) => void, | ||
}>; | ||
|
||
const handleSelectAssets = (files: Schema.Attribute.MediaValue<true>) => { | ||
const formattedFiles = files.map((f) => ({ | ||
alt: f.alternativeText || f.name, | ||
url: prefixFileUrlWithBackendUrl(f.url), | ||
mime: f.mime, | ||
})); | ||
|
||
onChange(formattedFiles); | ||
}; | ||
|
||
return ( | ||
<MediaLibraryDialog | ||
onClose={onToggle} | ||
onSelectAssets={handleSelectAssets} | ||
/> | ||
); | ||
}; | ||
|
||
MediaLib.defaultProps = { | ||
isOpen: false, | ||
onChange: (_files: Schema.Attribute.MediaValue<true>) => {}, | ||
onToggle: () => {}, | ||
}; | ||
|
||
export {MediaLib}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.