-
Notifications
You must be signed in to change notification settings - Fork 0
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
71 changed files
with
14,189 additions
and
4,232 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Deploy 'QuestVerse' App Components to Mainnet | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
deploy-mainnet: | ||
uses: nearbuilders/bos-workspace/.github/workflows/deploy.yml@main | ||
with: | ||
deploy-env: "mainnet" | ||
app-name: "QuestVerse" | ||
working-directory: "questverse-widgets" | ||
deploy-account-address: ${{ vars.PROD_SIGNER_ACCOUNT_ID }} | ||
signer-account-address: ${{ vars.PROD_SIGNER_ACCOUNT_ID }} | ||
signer-public-key: ${{ vars.PROD_SIGNER_PUBLIC_KEY }} | ||
secrets: | ||
SIGNER_PRIVATE_KEY: ${{ secrets.PROD_SIGNER_PRIVATE_KEY }} |
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,4 @@ | ||
node_modules | ||
/build | ||
/node_modules | ||
.vscode | ||
.DS_Store |
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,17 @@ | ||
## Getting Started | ||
|
||
``` | ||
npm install | ||
``` | ||
|
||
Then, run the command: | ||
|
||
``` | ||
npm run dev | ||
``` | ||
|
||
This will serve the widgets from `http://127.0.0.1:4040/`. | ||
|
||
Go to [everything.dev/flags](https://everything.dev) and paste this value there. | ||
|
||
Once set, see the locally served app at [bos.questverse.near/widget/app](https://everything.dev/bos.questverse.near/widget/app). |
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,8 @@ | ||
{ | ||
"appAccount": "bos.questverse.near", | ||
"aliases": { | ||
"QUESTVERSE_CONTRACT": "v1.questverse.near", | ||
"QUERYAPI_CONTRACT": "queryapi.dataplatform.near", | ||
"API_SIGNER_SERVICE": "https://" | ||
} | ||
} |
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,76 @@ | ||
const { page, ...passProps } = props; | ||
|
||
const { AppLayout } = VM.require( | ||
"/*__@appAccount__*//widget/components.Layout" | ||
); | ||
|
||
if (!AppLayout) { | ||
return <p>Loading modules...</p>; | ||
} | ||
|
||
// CSS styles to be used across the app. | ||
// Define fonts here, as well as any other global styles. | ||
const Theme = styled.div` | ||
a { | ||
color: inherit; | ||
} | ||
width: 100%; | ||
height: 100vh; | ||
`; | ||
|
||
if (!page) { | ||
// If no page is specified, we default to the feed page TEMP | ||
page = "dashboard"; | ||
} | ||
|
||
// This is our navigation, rendering the page based on the page parameter | ||
function Page() { | ||
const routes = page.split("."); | ||
switch (routes[0]) { | ||
case "dashboard": { | ||
return ( | ||
<Widget | ||
src="/*__@appAccount__*//widget/pages.Dashboard" | ||
props={passProps} | ||
/> | ||
); | ||
} | ||
case "discover": { | ||
return ( | ||
<Widget | ||
src="/*__@appAccount__*//widget/pages.Discover" | ||
props={passProps} | ||
/> | ||
); | ||
} | ||
case "create": { | ||
return ( | ||
<Widget | ||
src="/*__@appAccount__*//widget/pages.Create" | ||
props={passProps} | ||
/> | ||
); | ||
} | ||
case "quest": { | ||
return ( | ||
<Widget | ||
src="/*__@appAccount__*//widget/pages.Quest" | ||
props={passProps} | ||
/> | ||
); | ||
} | ||
default: { | ||
// TODO: 404 page | ||
return <p>404</p>; | ||
} | ||
} | ||
} | ||
|
||
return ( | ||
<Theme> | ||
<AppLayout page={page}> | ||
<Page /> | ||
</AppLayout> | ||
</Theme> | ||
); |
46 changes: 46 additions & 0 deletions
46
questverse-widgets/apps/QuestVerse/widget/components/Header.jsx
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,46 @@ | ||
const Toolbar = styled.div` | ||
margin-left: 20px; | ||
@media only screen and (max-width: 1061px) { | ||
margin: 10px 0 0 0; | ||
} | ||
`; | ||
|
||
const registryContract = "registry.i-am-human.near"; | ||
const issuer = "fractal.i-am-human.near"; | ||
|
||
// SBT verification | ||
let isVerified = false; | ||
const userSBTs = Near.view("registry.i-am-human.near", "sbt_tokens_by_owner", { | ||
account: context.accountId, | ||
}); | ||
|
||
for (let i = 0; i < userSBTs.length; i++) { | ||
if ("fractal.i-am-human.near" == userSBTs[i][0]) { | ||
isVerified = true; | ||
} | ||
} | ||
|
||
return ( | ||
<div className="d-flex p-3 px-4 align-items-center rounded justify-content-between bg-black"> | ||
<h3 className="mt-2" style={{ fontFamily: "Courier", color: "white" }}> | ||
<Link to="//*__@appAccount__*//widget/app"> | ||
<b>QuestVerse</b> | ||
</Link> | ||
</h3> | ||
<Toolbar> | ||
{!isVerified ? ( | ||
<Widget | ||
src="hack.near/widget/n.style" | ||
props={{ | ||
Link: { | ||
text: "Get Verified", | ||
href: "https://i-am-human.app/", | ||
}, | ||
}} | ||
/> | ||
) : ( | ||
<Widget src="hack.near/widget/start" /> | ||
)} | ||
</Toolbar> | ||
</div> | ||
); |
60 changes: 60 additions & 0 deletions
60
questverse-widgets/apps/QuestVerse/widget/components/Layout.jsx
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,60 @@ | ||
const Container = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
width: 100%; | ||
height: auto; | ||
min-height: 100vh; | ||
background: #f4f4f4; | ||
margin-top: calc(-1 * var(--body-top-padding)); | ||
`; | ||
|
||
const ContentContainer = styled.div` | ||
flex: 1; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
width: 100%; | ||
`; | ||
|
||
const Header = styled.div` | ||
background: black; | ||
`; | ||
|
||
const registryContract = "registry.i-am-human.near"; | ||
const issuer = "fractal.i-am-human.near"; | ||
|
||
// SBT verification | ||
let isVerified = false; | ||
const userSBTs = Near.view("registry.i-am-human.near", "sbt_tokens_by_owner", { | ||
account: props.accountId ?? context.accountId, | ||
}); | ||
|
||
for (let i = 0; i < userSBTs.length; i++) { | ||
if ("fractal.i-am-human.near" == userSBTs[i][0]) { | ||
isVerified = true; | ||
} | ||
} | ||
|
||
const AppHeader = ({ page }) => ( | ||
<Widget src="/*__@appAccount__*//widget/components.Header" props={{ page }} /> | ||
); | ||
|
||
const Footer = ({ page }) => { | ||
return <></>; | ||
}; | ||
|
||
function AppLayout({ page, children }) { | ||
return ( | ||
<> | ||
<Container> | ||
<AppHeader page={page} /> | ||
<ContentContainer>{children}</ContentContainer> | ||
<Footer page={page} /> | ||
</Container> | ||
</> | ||
); | ||
} | ||
|
||
return { AppLayout }; |
102 changes: 102 additions & 0 deletions
102
questverse-widgets/apps/QuestVerse/widget/components/createQuestSteps/Steps.jsx
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,102 @@ | ||
// import StepOne from "./StepOne"; | ||
// const { StepOne } = require("bos.questverse.near/newQuestComponents.StepOne"); | ||
|
||
const { fetch_step_one_data } = VM.require( | ||
"/*__@appAccount__*//widget/data.data_stepOne" | ||
); | ||
const stepOneData = fetch_step_one_data(); | ||
// const {stepOneData, stepTwoData} = VM.require("bos.questverse.near/module/data_all"); I can do it like this | ||
// const { StepOne } = require("./bos.questverse.near/newQuestComponents.StepTwo"); | ||
|
||
State.init({ | ||
step: 1, | ||
formData: { | ||
//STEP 1 | ||
selectedCurrency: "", | ||
selectedOption: "", | ||
selectedFields: [], | ||
//STEP 2 | ||
// audienceGroups: [], | ||
|
||
//STEP 3 | ||
|
||
|
||
// | ||
}, | ||
}); | ||
|
||
function handleNext(data) { | ||
State.update({ | ||
formData: { ...state.formData, ...data }, | ||
step: state.step + 1, | ||
}); | ||
} | ||
|
||
function handlePrevious() { | ||
State.update({ | ||
step: state.step + 1, | ||
}); | ||
} | ||
|
||
function renderStep() { | ||
switch (step) { | ||
case 1: | ||
return ( | ||
<Widget | ||
src={"/*__@appAccount__*//widget/components.createQuestSteps.stepOne"} | ||
props={{ | ||
data: stepOneData, | ||
onNext: handleNext, | ||
}} | ||
/> | ||
); | ||
case 2: | ||
return <StepTwo onNext={handleNext} />; | ||
// case 3: | ||
// return <StepThree data={} onNext={handleNext} onPrevious={handlePrevious} />; | ||
default: | ||
return ( | ||
<Widget | ||
src={"/*__@appAccount__*//widget/components.createQuestSteps.stepOne"} | ||
props={{ | ||
data: stepOneData, | ||
onNext: handleNext, | ||
}} | ||
/> | ||
); | ||
} | ||
} | ||
|
||
return ( | ||
<div> | ||
<h1>Create Quest</h1> | ||
{renderStep()} | ||
|
||
{state.step !== 1 && ( | ||
<button type="button" onClick={handlePrevious}> | ||
Previous | ||
</button> | ||
)} | ||
|
||
{state.step === totalSteps && <button type="submit">Submit</button>} | ||
</div> | ||
); | ||
|
||
//I wanted to pass in all JSON configs here | ||
|
||
|
||
|
||
/** | ||
* | ||
* JSON -> Functions w req | ||
* | ||
* | ||
*/ | ||
|
||
|
||
|
||
/** | ||
* | ||
* | ||
* CREATE QUEST | ||
*/ |
Oops, something went wrong.