-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
272 additions
and
37 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,3 +1,5 @@ | ||
REACT_APP_URL = "http://localhost:3000" | ||
REACT_APP_MEMOREC = "http://memorec:8080" | ||
REACT_APP_URL="http://localhost:3000" | ||
REACT_APP_MEMOREC="http://memorec:8080" | ||
REACT_APP_COLLABORATIVE_REST="http://collaborative:5002" | ||
REACT_APP_COLLABORATIVE_SOCKET="ws://collaborative:5001" | ||
|
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,2 +1,4 @@ | ||
REACT_APP_URL = "https://app.jjodel.io" | ||
REACT_APP_MEMOREC = "https://app.jjodel.io/memorec" | ||
REACT_APP_COLLABORATIVE_REST = "http://localhost:5002" | ||
|
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,5 +1,25 @@ | ||
Instructions (docker is required): | ||
|
||
## Full Deploy Instructions (docker is required): | ||
- Clone the repository: https://github.com/DamianoNaraku/jodel-react.git | ||
- Run: docker compose up -d | ||
- Go to: http://localhost:3000 | ||
|
||
This version includes memorec model suggestions and collaborative live editing rooms. | ||
|
||
|
||
# Core functionalities version | ||
The application is publicly accessible at [this link.](https://damianonaraku.github.io/jodel-react/build/) | ||
|
||
If you want to run it locally, clone this repository, [install node.js and npm](https://nodejs.org/it/download), then run the following commands with a terminal opened at project's root folder | ||
|
||
`npm install` | ||
|
||
`npm run start` | ||
|
||
or | ||
|
||
`npm install` | ||
|
||
`npm run build` | ||
|
||
# Links | ||
[MDEGroup jodel repository](https://github.com/MDEGroup/jjodel): This is where stable, production-ready versions are released. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,14 @@ | ||
import {io} from 'socket.io-client'; | ||
import axios from 'axios'; | ||
|
||
export default class Collaborative { | ||
static client = io('/', {path: '/collaborative', autoConnect: false}); | ||
static async init(code: string) { | ||
const actions = await axios.get(`/collaborative/rooms/${code}`); | ||
return actions.data; | ||
} | ||
static async createRoom() { | ||
const code = await axios.post(`/collaborative/rooms`); | ||
return code.data; | ||
} | ||
} |
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,39 @@ | ||
import React from 'react'; | ||
import Collaborative from './Collaborative'; | ||
import App from '../../App'; | ||
import {Action, SetRootFieldAction} from '../../joiner'; | ||
import {useParams} from 'react-router-dom'; | ||
import {useEffectOnce} from 'usehooks-ts'; | ||
|
||
interface Props{} | ||
function CollaborativeAttacher(props: Props) { | ||
const {id} = useParams(); | ||
const code = id ? id : ''; | ||
|
||
useEffectOnce(() => { | ||
Collaborative.init(code).then(async(actions) => { | ||
for(let action of actions) { | ||
if(action.type === 'COMPOSITE_ACTION') for(let subAction of action.actions) delete subAction['_id']; | ||
delete action['_id']; | ||
const receivedAction = Action.fromJson(action); | ||
receivedAction.hasFired = receivedAction.hasFired - 1; | ||
receivedAction.fire(); | ||
} | ||
Collaborative.client.io.opts.query = {code}; | ||
Collaborative.client.connect(); | ||
SetRootFieldAction.new('room', code, '', false); | ||
}) | ||
}); | ||
|
||
Collaborative.client.on('pullAction', (action) => { | ||
if(action.type === 'COMPOSITE_ACTION') for(let subAction of action.actions) delete subAction['_id']; | ||
delete action['_id']; | ||
const receivedAction = Action.fromJson(action); | ||
receivedAction.hasFired = receivedAction.hasFired - 1; | ||
receivedAction.fire(); | ||
}); | ||
|
||
return(<App />); | ||
} | ||
|
||
export default CollaborativeAttacher; |
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
Oops, something went wrong.