Skip to content

Commit

Permalink
Add Feature: goToExternalPage
Browse files Browse the repository at this point in the history
It lets the user go to external pages other than the current local directory
  • Loading branch information
alexis-opolka committed Nov 30, 2023
1 parent 9b0b953 commit 157be04
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as MessageAppInterfaces from "@/components/phoneComponents/MessageApp/M
export const allowedChoiceActions = [
// Actions to be taken related to the page
"goToPageIndex",
"goToExternalPageIndex",
// Actions to be taken related to the messages
"displayMessage",
"replaceMessage",
Expand Down
5 changes: 4 additions & 1 deletion src/components/phoneComponents/MessageApp/BardDiscussion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@ export default function BardDiscussion(props: any){
return addMessageToHistory(message);
} else if (action.type === "goToPageIndex") {
nextRouter.push(action.target);
} else {
} else if (action.type === "goToExternalPageIndex"){
nextRouter.push(action.target);
}
else {
console.error(`The action "${action.type}" is not implemented!`);
}
}
Expand Down
18 changes: 15 additions & 3 deletions src/components/phoneComponents/MessageApp/MessageChoices.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DiscussionChoicesInterface } from "./MessageAppInterfaces";
import { authorPlayer, guestPlayer } from "./MessagePlayers";
import { authorPlayer, bardPlayer, guestPlayer } from "./MessagePlayers";

export const messageChoices: DiscussionChoicesInterface[] = [
// The first choice and the default one
Expand Down Expand Up @@ -102,8 +102,8 @@ export const messageChoices: DiscussionChoicesInterface[] = [
messagesToShow: [],
actions: [
{
type: "goToPageIndex",
target: "/projects"
type: "goToExternalPageIndex",
target: "https://github.com/alexis-opolka/"
}
]
},
Expand All @@ -118,5 +118,17 @@ export const messageChoices: DiscussionChoicesInterface[] = [
]
}
]
},
{
type: "choices",
startMessages: [
{
"author": bardPlayer,
"content": "Hello, I'm testing a new way of calling pages.",
"type": "message"
}
],
startActions: [],
options: []
}
]

0 comments on commit 157be04

Please sign in to comment.