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

fix(website): fix i18n routes for Canny board #5902

Merged
merged 1 commit into from Nov 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions website/src/featureRequests/FeatureRequestsPage.tsx
Expand Up @@ -14,16 +14,16 @@ import styles from './styles.module.css';

const BOARD_TOKEN = '054e0e53-d951-b14c-7e74-9eb8f9ed2f91';

function FeatureRequests(): JSX.Element {
function FeatureRequests({basePath}: {basePath: string}): JSX.Element {
useEffect(() => {
cannyScript();
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const {Canny} = window as any;
Canny('render', {
boardToken: BOARD_TOKEN,
basePath: '/feature-requests',
basePath,
});
}, []);
}, [basePath]);

return (
<Layout title="Feedback" description="Docusaurus 2 Feature Requests page">
Expand Down
7 changes: 6 additions & 1 deletion website/src/featureRequests/FeatureRequestsPlugin.js
Expand Up @@ -15,10 +15,15 @@ function FeatureRequestsPlugin(context) {
return {
name: 'feature-requests-plugin',
async contentLoaded({actions}) {
const basePath = normalizeUrl([context.baseUrl, '/feature-requests']);
await actions.createData('paths.json', JSON.stringify(basePath));
actions.addRoute({
path: normalizeUrl([context.baseUrl, '/feature-requests']),
path: basePath,
exact: false,
component: '@site/src/featureRequests/FeatureRequestsPage',
modules: {
basePath: './feature-requests-plugin/default/paths.json',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createData returns the module path, you don't need to hardcode it :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, I never understood how these APIs work... I'll look deeper into how they're implemented and maybe improve the documentation on this😄

},
});
},
};
Expand Down