Commit e55e6613 authored by Amit Sharma's avatar Amit Sharma
Browse files

Added env script for reach

Showing with 17 additions and 18 deletions
+17 -18
...@@ -3,6 +3,7 @@ tasks: ...@@ -3,6 +3,7 @@ tasks:
openMode: tab-after openMode: tab-after
init: | init: |
bash install-node.sh bash install-node.sh
bash make-envs-for-react.sh
nvm use 14 nvm use 14
cd packages/enketo-express && pnpm i && pnpm i -g grunt cd packages/enketo-express && pnpm i && pnpm i -g grunt
gp sync-done setup gp sync-done setup
......
...@@ -2,7 +2,6 @@ import './App.css'; ...@@ -2,7 +2,6 @@ import './App.css';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import GenericForm from './components/GenericForm'; import GenericForm from './components/GenericForm';
function App() { function App() {
const [flows, setFlows] = useState([ const [flows, setFlows] = useState([
{ {
...@@ -40,7 +39,7 @@ function App() { ...@@ -40,7 +39,7 @@ function App() {
{flows?.map(el => <div className='workflowBtns' onClick={() => setSelectedFlow(el)}>{el.name}</div>)} {flows?.map(el => <div className='workflowBtns' onClick={() => setSelectedFlow(el)}>{el.name}</div>)}
</div> </div>
</> </>
: <GenericForm {...{ selectedFlow }} /> : <GenericForm {...{ selectedFlow, setSelectedFlow}} />
} }
</div> </div>
......
...@@ -4,7 +4,7 @@ import styles from './index.module.css'; ...@@ -4,7 +4,7 @@ import styles from './index.module.css';
const GITPOD_URL = process.env.GITPOD_WORKSPACE_URL const GITPOD_URL = process.env.GITPOD_WORKSPACE_URL
const GenericForm = (props) => { const GenericForm = (props) => {
const { selectedFlow } = props; const { selectedFlow, setSelectedFlow } = props;
const formSpec = require(`../../${selectedFlow.config}`); const formSpec = require(`../../${selectedFlow.config}`);
const [isFirst, setIsFirst] = useState(true); const [isFirst, setIsFirst] = useState(true);
// Encode string method to URI // Encode string method to URI
...@@ -14,6 +14,7 @@ const GenericForm = (props) => { ...@@ -14,6 +14,7 @@ const GenericForm = (props) => {
const getFormURI = (form, ofsd, prefillSpec) => { const getFormURI = (form, ofsd, prefillSpec) => {
console.log(form, ofsd, prefillSpec); console.log(form, ofsd, prefillSpec);
// return encodeURIComponent(`https://3006-samagradevelop-workflow-gkbrz650idv.ws-us89b.gitpod.io/prefill?form=${form}&onFormSuccessData=${encodeFunction(ofsd)}&prefillSpec=${encodeFunction(prefillSpec)}`);
return encodeURIComponent(`${GITPOD_URL.slice(0, GITPOD_URL.indexOf('/') + 2) + "3006-" + GITPOD_URL.slice(GITPOD_URL.indexOf('/') + 2)}/prefill?form=${form}&onFormSuccessData=${encodeFunction(ofsd)}&prefillSpec=${encodeFunction(prefillSpec)}`); return encodeURIComponent(`${GITPOD_URL.slice(0, GITPOD_URL.indexOf('/') + 2) + "3006-" + GITPOD_URL.slice(GITPOD_URL.indexOf('/') + 2)}/prefill?form=${form}&onFormSuccessData=${encodeFunction(ofsd)}&prefillSpec=${encodeFunction(prefillSpec)}`);
} }
...@@ -56,10 +57,8 @@ const GenericForm = (props) => { ...@@ -56,10 +57,8 @@ const GenericForm = (props) => {
return ( return (
<div className={styles.container}> <div className={styles.container}>
<div className={styles.header}> <div>{selectedFlow.name}</div>
<div>Go back</div> <div onClick={() => setSelectedFlow({})}>Go Back</div>
<div>{selectedFlow.name}</div>
</div>
<iframe title='current-form' <iframe title='current-form'
className={styles.odkForm} className={styles.odkForm}
src={ src={
......
...@@ -6,23 +6,22 @@ ...@@ -6,23 +6,22 @@
align-items: center; align-items: center;
width: 40vw; width: 40vw;
padding-bottom: 2rem; padding-bottom: 2rem;
position: relative;
} }
.header { .container >div:nth-child(1) {
display: flex; font-size: 3rem;
flex-direction: row;
width: 100%;
justify-content: space-between;
}
.header:nth-child(1) {
font-size: 1rem;
color: #ffc119; color: #ffc119;
} }
.header:nth-child(2) { .container >div:nth-child(2) {
font-size: 3rem; font-size: 1rem;
color: #ffc119; color: #ffc119;
position: absolute;
top: 0;
left: 0;
cursor: pointer;
margin-top: 1.5rem;
} }
.odkForm { .odkForm {
......
echo REACT_APP_GITPOD_WORKSPACE_URL=${GITPOD_WORKSPACE_URL} > ./apps/wrappers/.env
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment