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

Release v0.1.1 #48

Merged
merged 31 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e57cba0
iframe communication posting page change & page height info
bobbykolev Dec 19, 2024
a06c18c
pr and AI improvements
bobbykolev Dec 19, 2024
453c8e5
empty
keyboardguy25 Dec 20, 2024
f83624a
Merge pull request #21 from alkem-io/test01
SimoneZaza Dec 20, 2024
f00f52c
Merge pull request #19 from alkem-io/client-7266-docs
reactoholic Dec 20, 2024
698cc77
readme.md updated with deployment info
bobbykolev Dec 20, 2024
a479e16
0.0.2 (#23) (#24)
bobbykolev Dec 20, 2024
fe53a4d
version bump 0.0.3 (#25)
bobbykolev Dec 23, 2024
fa1da8d
set proper origin for the iframe communication (#26)
bobbykolev Dec 23, 2024
a3ffe01
crowdin.yml
hero101 Jan 22, 2025
97f5336
crowdin.yml initial commit
hero101 Jan 22, 2025
9f18e37
crowdin new config
hero101 Jan 22, 2025
b26753c
Updated introduction and getting started, not yet create Space
DonnaDuiker Jan 17, 2025
b64c4db
resolving conflict and turn off german option
DonnaDuiker Jan 31, 2025
7f2fd31
updating getting started section
DonnaDuiker Jan 31, 2025
89766d0
delete german files
DonnaDuiker Feb 3, 2025
2c232b3
Merge pull request #38 from alkem-io/fix-updates
SimoneZaza Feb 3, 2025
8ab3973
Updating structure section
DonnaDuiker Feb 4, 2025
49e1aef
additions to subspace page and deletions from profile page
DonnaDuiker Feb 4, 2025
a5ddff4
fix typo
DonnaDuiker Feb 4, 2025
1a3dcfb
forgot to save 1 file
DonnaDuiker Feb 4, 2025
1f4d9b7
Merge pull request #39 from alkem-io/Updating-docs-part2
SimoneZaza Feb 4, 2025
0cbbdcf
New Crowdin updates (#34)
hero101 Feb 6, 2025
3f7e643
Merge pull request #40 from alkem-io/l10n_develop_PRs
hero101 Feb 6, 2025
fbd5bc1
fixed issue in one translation
hero101 Feb 6, 2025
c4dc209
Merge pull request #41 from alkem-io/translation-issue
DonnaDuiker Feb 6, 2025
61019f2
enable scrolling locally, but keep disabled in iframe (#43)
DonnaDuiker Feb 7, 2025
de17ce8
Updating NL Menu
DonnaDuiker Feb 11, 2025
0664246
Merge pull request #46 from alkem-io/updating-docs-part3
SimoneZaza Feb 11, 2025
a5b266f
Revert back the full page scroll logic + fix infinite scroll updates …
bobbykolev Feb 11, 2025
6ffd50d
Merge branch 'main' into develop
bobbykolev Feb 11, 2025
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
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
dist: focal
language: node_js
node_js:
- v20.13.1
cache:
directories:
- node_modules
before_install:
- npm i -g [email protected]
install:
- npm install
script:
- npm run build
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
`npm i`
`npm run dev`

###### prerequisits
###### prerequisites

It's recommended to use [volta](https://docs.volta.sh/guide/getting-started)
```
Expand Down Expand Up @@ -53,4 +53,24 @@ _meta.en-US.json

At the moment the i18n is done manually by the nextra guide - https://nextra.site/docs/guide/i18n

We'll explore the option to use Crowdin instead.
We'll explore the option to use Crowdin instead.

### Build & Deployment

The build and deployments are automatic on merge.

In order to deploy it to dev/acc, merge to `develop` branch.

For production release you need to merge to `main` branch.
For proper redeployment make sure you bump the version on every merge to main.

Use the following:
```
npm version patch
```
this will bump the patch version and make a commit (e.g. 0.0.1 -> 0.0.2).

Or manually update the npm version in the package.json file.
Then run `npm install` and commit the changes.

Once merged into `main`, make sure to merge `main` back to `develop` (to sync the version).
79 changes: 79 additions & 0 deletions components/iframeCommunication.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import { useEffect, useRef } from 'react';
import { useRouter } from 'next/router';

const HEIGHT_DIFFERENCE_THRESHOLD = 130; // ~30 locally and 122 on Sandbox (Donna PC)

const allowedOrigins = ['https://alkem.io', 'https://dev-alkem.io', 'https://acc-alkem.io', 'https://sandbox-alkem.io', 'http://localhost:3000'];
const isOriginValid = (origin) => allowedOrigins.includes(origin);

const getCurrentOrigin = () => {
const { protocol, hostname, origin, port } = window.location;
if (port) {
return `${protocol}//${hostname}:3000`; // local client port
}

return origin;
};

const sendMessageToParent = (message) => {
try {
const origin = getCurrentOrigin();

if (!isOriginValid(origin)) {
console.warn('Invalid origin: ', origin);
return;
}

window.parent.postMessage(message, getCurrentOrigin());
} catch (error) {
console.warn('Failed to send message to parent: ', error);
}
};

const SupportedMessageTypes = {
PageHeight: 'PAGE_HEIGHT',
PageChange: 'PAGE_CHANGE',
};

const IframeCommunication = () => {
const router = useRouter();
const lastHeight = useRef(0);
const debounceTimeout = useRef(null);

const sendPageHeight = () => {
const pageHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
console.log('Scroll change new/old: ', pageHeight, lastHeight.current);

// Only send if there's a meaningful difference in height
if (Math.abs(pageHeight - lastHeight.current) > HEIGHT_DIFFERENCE_THRESHOLD) {
lastHeight.current = pageHeight;

// Debounce the message to avoid excessive calls
clearTimeout(debounceTimeout.current);
debounceTimeout.current = setTimeout(() => {
console.log('Scroll change SENT: ', pageHeight, lastHeight.current);
sendMessageToParent({ type: SupportedMessageTypes.PageHeight, height: pageHeight });
}, 50);
}
};


useEffect(() => {
// Send path
sendMessageToParent({ type: SupportedMessageTypes.PageChange, url: router.pathname });

// Observe changes to the body size
const resizeObserver = new ResizeObserver(sendPageHeight);
resizeObserver.observe(document.body);

// Cleanup
return () => {
resizeObserver.disconnect();
clearTimeout(debounceTimeout.current);
};
}, [router.pathname]);

return null;
};

export default IframeCommunication;
9 changes: 9 additions & 0 deletions crowdin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"files": [
{
"source": "/pages/**/*.en-US.mdx",
"translation": "/pages/**/%file_name%.%locale%.mdx",
"translation_replace": {
".en-US": ""
}
}
]
2 changes: 1 addition & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const withNextra = require('nextra')({
module.exports = withNextra({
// output: 'export', not working with i18n
i18n: {
locales: ['en-US', 'de-DE'],
locales: ['en-US', 'nl-NL'],
defaultLocale: 'en-US'
},
images: {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

32 changes: 31 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1 +1,31 @@
{"name":"@alkemio/documentation","version":"0.0.3","description":"Alkemio platform documentation","author":"Alkemio Foundation","repository":{"type":"git","url":"https://github.com/alkem-io/documentation"},"license":"EUPL-1.2","scripts":{"dev":"next -p 3010","build":"next build","start":"next start -p 3010","export":"next export"},"dependencies":{"next":"^14.2.5","nextra":"^2.13.4","nextra-theme-docs":"^2.13.4","react":"^18.3.1","react-dom":"^18.3.1"},"engines":{"node":">=20.9.0","npm":">=10"},"volta":{"node":"20.13.1"}}
{
"name": "@alkemio/documentation",
"version": "0.1.1",
"description": "Alkemio platform documentation",
"author": "Alkemio Foundation",
"repository": {
"type": "git",
"url": "https://github.com/alkem-io/documentation"
},
"license": "EUPL-1.2",
"scripts": {
"dev": "next -p 3010",
"build": "next build",
"start": "next start -p 3010",
"export": "next export"
},
"dependencies": {
"next": "^14.2.5",
"nextra": "^2.13.4",
"nextra-theme-docs": "^2.13.4",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"engines": {
"node": ">=20.9.0",
"npm": ">=10"
},
"volta": {
"node": "20.13.1"
}
}
22 changes: 18 additions & 4 deletions pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
import '../styles.css'

// This default export is required in a new `pages/_app.js` file.
import { useEffect } from 'react';
import '../styles.css';
import IframeCommunication from '../components/iframeCommunication';

export default function MyApp({ Component, pageProps }) {
return <Component {...pageProps} />
useEffect(() => {
try {
if (window.self === window.top) {
document.body.classList.add("not-in-iframe");
}
} catch (e) {}
}, []);

return (
<>
<IframeCommunication />
<Component {...pageProps} />
</>
);
}
40 changes: 0 additions & 40 deletions pages/_meta.de-DE.json

This file was deleted.

4 changes: 4 additions & 0 deletions pages/_meta.en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
"pagination": true
},
"submenus": [
{
"title": "First Steps",
"path": "/getting-started/first-steps"
},
{
"title": "Create an Account",
"path": "/getting-started/create-account"
Expand Down
Loading
Loading