diff --git a/src/api/api.js b/src/api/api.js
index 00497914f..0db33d1be 100644
--- a/src/api/api.js
+++ b/src/api/api.js
@@ -286,6 +286,11 @@ class API {
return data;
}
+ async getTemporaryBoard(id) {
+ const { data } = await this.axiosInstance.get(`/board/temporary/${id}`);
+ return data;
+ }
+
async getSettings() {
const authToken = getAuthToken();
if (!(authToken && authToken.length)) {
diff --git a/src/components/Board/Board.container.js b/src/components/Board/Board.container.js
index ada9adc83..2a89809be 100644
--- a/src/components/Board/Board.container.js
+++ b/src/components/Board/Board.container.js
@@ -200,7 +200,8 @@ export class BoardContainer extends Component {
isFixedBoard: false,
copiedTiles: [],
isScroll: false,
- totalRows: null
+ totalRows: null,
+ isCbuilderBoard: false
};
constructor(props) {
super(props);
@@ -377,8 +378,16 @@ export class BoardContainer extends Component {
}
async tryRemoteBoard(boardId) {
- const { userData } = this.props;
- const remoteBoard = await API.getBoard(boardId);
+ const { userData, location } = this.props;
+
+ const queryParams = new URLSearchParams(location.search);
+ const isCbuilderBoard = queryParams.get('cbuilder');
+
+ const remoteBoard = isCbuilderBoard
+ ? await API.getTemporaryBoard(boardId)
+ : await API.getBoard(boardId);
+
+ this.setState({ isCbuilderBoard });
//if requested board is from the user just add it
if (
'name' in userData &&
@@ -386,6 +395,10 @@ export class BoardContainer extends Component {
remoteBoard.email === userData.email &&
remoteBoard.author === userData.name
) {
+ if (isCbuilderBoard) {
+ this.setState({ copyPublicBoard: remoteBoard });
+ return null;
+ }
return remoteBoard;
} else {
//if requested board is public, ask about copy it
@@ -1356,7 +1369,8 @@ export class BoardContainer extends Component {
if (isSaving) return;
this.setState({
copyPublicBoard: false,
- blockedPrivateBoard: false
+ blockedPrivateBoard: false,
+ isCbuilderBoard: false
});
};
@@ -1524,6 +1538,7 @@ export class BoardContainer extends Component {
improvedPhrase,
speak
} = this.props;
+ const { isCbuilderBoard } = this.state;
if (!this.state.translatedBoard) {
return (
@@ -1608,11 +1623,19 @@ export class BoardContainer extends Component {
aria-describedby="dialog-copy-desc"
>
- {this.props.intl.formatMessage(messages.copyPublicBoardTitle)}
+ {this.props.intl.formatMessage(
+ isCbuilderBoard
+ ? messages.importCbuilderBoardTitle
+ : messages.copyPublicBoardTitle
+ )}
- {this.props.intl.formatMessage(messages.copyPublicBoardDesc)}
+ {this.props.intl.formatMessage(
+ isCbuilderBoard
+ ? messages.importCbuilderBoardDesc
+ : messages.copyPublicBoardDesc
+ )}
@@ -1648,11 +1671,19 @@ export class BoardContainer extends Component {
aria-describedby="dialog-blocked-desc"
>
- {this.props.intl.formatMessage(messages.blockedPrivateBoardTitle)}
+ {this.props.intl.formatMessage(
+ isCbuilderBoard
+ ? messages.importCbuilderBoardTitle
+ : messages.blockedPrivateBoardTitle
+ )}
- {this.props.intl.formatMessage(messages.blockedPrivateBoardDesc)}
+ {this.props.intl.formatMessage(
+ isCbuilderBoard
+ ? messages.loginToImport
+ : messages.blockedPrivateBoardDesc
+ )}
diff --git a/src/components/Board/Board.messages.js b/src/components/Board/Board.messages.js
index b9e63aed9..3d35d2390 100644
--- a/src/components/Board/Board.messages.js
+++ b/src/components/Board/Board.messages.js
@@ -218,5 +218,19 @@ export default defineMessages({
writeAndSay: {
id: 'cboard.components.Board.writeAndSay',
defaultMessage: 'Write and say'
+ },
+ importCbuilderBoardTitle: {
+ id: 'cboard.components.Board.importCbuilderBoardTitle',
+ defaultMessage: 'Import CBuilder Board'
+ },
+ importCbuilderBoardDesc: {
+ id: 'cboard.components.Board.importCbuilderBoardDesc',
+ defaultMessage:
+ 'You are trying to import a CBuilder board. In order to use and edit this board you have to copy it into your communicator boards.'
+ },
+ loginToImport: {
+ id: 'cboard.components.Board.loginToImport',
+ defaultMessage:
+ 'In order to import a CBuilder board you have to be logged in.'
}
});
diff --git a/src/translations/src/cboard.json b/src/translations/src/cboard.json
index f4a528fe7..d672202dc 100644
--- a/src/translations/src/cboard.json
+++ b/src/translations/src/cboard.json
@@ -169,6 +169,9 @@
"cboard.components.Board.userProfileLocked": "User Profile is locked, please unlock settings to see your user profile.",
"cboard.components.Board.live": "LIVE",
"cboard.components.Board.writeAndSay": "Write and say",
+ "cboard.components.Board.importCbuilderBoardTitle": "Import CBuilder Board",
+ "cboard.components.Board.importCbuilderBoardDesc": "You are trying to import a CBuilder board. In order to use and edit this board you have to copy it into your communicator boards.",
+ "cboard.components.Board.loginToImport": "In order to import a CBuilder board you have to be logged in.",
"cboard.components.Board.ImageEditor.title": "Image editor",
"cboard.components.Board.ImageEditor.rotateRight": "Rotate right",
"cboard.components.Board.ImageEditor.cropImage": "Crop image",