-
-
Notifications
You must be signed in to change notification settings - Fork 638
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* main: (27 commits) React Router 7 experimental PoC (#6472) First batch of the overhaul of the add-ons section (#6397) URL Management control panel: show errors from CSV upload (#6473) Release 18.0.3 Release @plone/registry 2.1.2 Preparing for 18.0.3 Fix weird issue in images build with typings (#6471) Release 18.0.2 Release @plone/providers 1.0.0-alpha.5 Release @plone/scripts 3.8.1 Release @plone/components 2.1.1 Fix packaging and plone/components src export (#6470) Release @plone/registry 2.1.1 Repackage registry Release 18.0.1 Release @plone/providers 1.0.0-alpha.4 Release @plone/components 2.1.0 Release @plone/client 1.0.0-alpha.20 Release @plone/scripts 3.8.0 Release @plone/registry 2.1.0 ...
- Loading branch information
Showing
250 changed files
with
4,231 additions
and
3,184 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
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 |
---|---|---|
|
@@ -72,6 +72,4 @@ docs/_build/ | |
/.tool-versions | ||
docs/source/news | ||
|
||
.turbo | ||
.parcel-cache/ | ||
tsconfig.tsbuildinfo |
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
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,80 @@ | ||
/** | ||
* This is intended to be a basic starting point for linting in your app. | ||
* It relies on recommended configs out of the box for simplicity, but you can | ||
* and should modify this configuration to best suit your team's needs. | ||
*/ | ||
|
||
/** @type {import('eslint').Linter.Config} */ | ||
module.exports = { | ||
root: true, | ||
parserOptions: { | ||
ecmaVersion: 'latest', | ||
sourceType: 'module', | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
env: { | ||
browser: true, | ||
commonjs: true, | ||
es6: true, | ||
}, | ||
|
||
// Base config | ||
extends: ['eslint:recommended'], | ||
|
||
overrides: [ | ||
// React | ||
{ | ||
files: ['**/*.{js,jsx,ts,tsx}'], | ||
plugins: ['react', 'jsx-a11y'], | ||
extends: [ | ||
'plugin:react/recommended', | ||
'plugin:react/jsx-runtime', | ||
'plugin:react-hooks/recommended', | ||
'plugin:jsx-a11y/recommended', | ||
], | ||
settings: { | ||
react: { | ||
version: 'detect', | ||
}, | ||
formComponents: ['Form'], | ||
linkComponents: [ | ||
{ name: 'Link', linkAttribute: 'to' }, | ||
{ name: 'NavLink', linkAttribute: 'to' }, | ||
], | ||
}, | ||
}, | ||
|
||
// Typescript | ||
{ | ||
files: ['**/*.{ts,tsx}'], | ||
plugins: ['@typescript-eslint', 'import'], | ||
parser: '@typescript-eslint/parser', | ||
settings: { | ||
'import/internal-regex': '^~/', | ||
'import/resolver': { | ||
node: { | ||
extensions: ['.ts', '.tsx'], | ||
}, | ||
typescript: { | ||
alwaysTryTypes: true, | ||
}, | ||
}, | ||
}, | ||
extends: [ | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:import/recommended', | ||
'plugin:import/typescript', | ||
], | ||
}, | ||
|
||
// Node | ||
{ | ||
files: ['.eslintrc.js'], | ||
env: { | ||
node: true, | ||
}, | ||
}, | ||
], | ||
}; |
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,7 @@ | ||
node_modules | ||
|
||
/.cache | ||
/build | ||
.env | ||
.react-router | ||
.registry.loader.js |
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,30 @@ | ||
# Plone on React Router 7 | ||
|
||
This is a proof of concept of a [React Router](https://reactrouter.com/dev/docs) app, using the `@plone/*` libraries. | ||
This is intended to serve as both a playground for the development of both packages and as a demo of Plone using Remix. | ||
|
||
> [!WARNING] | ||
> This package or app is experimental. | ||
> The community offers no support whatsoever for it. | ||
> Breaking changes may occur without notice. | ||
## Development | ||
|
||
To start, from the root of the monorepo: | ||
|
||
```shell | ||
pnpm install | ||
pnpm --filter plone-remix run dev | ||
``` | ||
|
||
Then start the Plone backend: | ||
|
||
% TODO MAKEFILE | ||
```shell | ||
make backend-docker-start | ||
``` | ||
|
||
|
||
## About this app | ||
|
||
- [Remix Docs](https://remix.run/docs/en/main) |
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,8 @@ | ||
import ploneClient from '@plone/client'; | ||
import config from '@plone/registry'; | ||
|
||
const cli = ploneClient.initialize({ | ||
apiPath: config.settings.apiPath, | ||
}); | ||
|
||
export { cli as ploneClient }; |
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,15 @@ | ||
import config from '@plone/registry'; | ||
import { blocksConfig, slate } from '@plone/blocks'; | ||
|
||
const settings = { | ||
apiPath: 'http://localhost:3000', | ||
slate, | ||
}; | ||
|
||
// @ts-expect-error We need to fix typing | ||
config.set('settings', settings); | ||
|
||
// @ts-expect-error We need to fix typing | ||
config.set('blocks', { blocksConfig }); | ||
|
||
export default config; |
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,98 @@ | ||
import { useState } from 'react'; | ||
import { | ||
Links, | ||
Meta, | ||
Outlet, | ||
Scripts, | ||
ScrollRestoration, | ||
useHref, | ||
useLocation, | ||
useNavigate, | ||
useParams, | ||
} from 'react-router'; | ||
import type { LinksFunction } from 'react-router'; | ||
|
||
import { QueryClient } from '@tanstack/react-query'; | ||
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; | ||
import PloneClient from '@plone/client'; | ||
import { PloneProvider } from '@plone/providers'; | ||
import { flattenToAppURL } from './utils'; | ||
import config from '@plone/registry'; | ||
import './config'; | ||
|
||
import '@plone/components/dist/basic.css'; | ||
|
||
function useHrefLocal(to: string) { | ||
return useHref(flattenToAppURL(to)); | ||
} | ||
|
||
export const links: LinksFunction = () => [ | ||
{ rel: 'preconnect', href: 'https://fonts.googleapis.com' }, | ||
{ | ||
rel: 'preconnect', | ||
href: 'https://fonts.gstatic.com', | ||
crossOrigin: 'anonymous', | ||
}, | ||
{ | ||
rel: 'stylesheet', | ||
href: 'https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap', | ||
}, | ||
]; | ||
|
||
export function Layout({ children }: { children: React.ReactNode }) { | ||
return ( | ||
<html lang="en"> | ||
<head> | ||
<meta charSet="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<Meta /> | ||
<Links /> | ||
</head> | ||
<body> | ||
{children} | ||
<ScrollRestoration /> | ||
<Scripts /> | ||
</body> | ||
</html> | ||
); | ||
} | ||
|
||
export default function App() { | ||
const [queryClient] = useState( | ||
() => | ||
new QueryClient({ | ||
defaultOptions: { | ||
queries: { | ||
// With SSR, we usually want to set some default staleTime | ||
// above 0 to avoid refetching immediately on the client | ||
staleTime: 60 * 1000, | ||
}, | ||
}, | ||
}), | ||
); | ||
|
||
const [ploneClient] = useState(() => | ||
PloneClient.initialize({ | ||
apiPath: config.settings.apiPath, | ||
}), | ||
); | ||
|
||
const RRNavigate = useNavigate(); | ||
const navigate = (to: string) => { | ||
return RRNavigate(flattenToAppURL(to)); | ||
}; | ||
|
||
return ( | ||
<PloneProvider | ||
ploneClient={ploneClient} | ||
queryClient={queryClient} | ||
useLocation={useLocation} | ||
useParams={useParams} | ||
useHref={useHrefLocal} | ||
navigate={navigate} | ||
> | ||
<Outlet /> | ||
<ReactQueryDevtools initialIsOpen={false} /> | ||
</PloneProvider> | ||
); | ||
} |
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,7 @@ | ||
import type { RouteConfig } from '@react-router/dev/routes'; | ||
import { index, route } from '@react-router/dev/routes'; | ||
|
||
export const routes: RouteConfig = [ | ||
index('routes/home.tsx'), | ||
route('*', 'routes/$.tsx'), | ||
]; |
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 @@ | ||
import Content, { loader } from './home'; | ||
export { loader, Content as default }; |
Oops, something went wrong.