Skip to content

Commit

Permalink
Merge pull request #1 from eyra/remove-interface-components
Browse files Browse the repository at this point in the history
Removed all side-interface components
  • Loading branch information
vloothuis authored Dec 2, 2023
2 parents b9fa4c5 + 199c2b3 commit 784fca5
Show file tree
Hide file tree
Showing 11 changed files with 7 additions and 298 deletions.
Binary file modified public/port-0.0.0-py3-none-any.whl
Binary file not shown.
Binary file modified src/framework/processing/py/dist/port-0.0.0-py3-none-any.whl
Binary file not shown.
22 changes: 2 additions & 20 deletions src/framework/processing/worker_engine.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CommandHandler, ProcessingEngine } from '../types/modules'
import { CommandSystemDonate, CommandUIRender, isCommand, Response } from '../types/commands'
import { CommandSystemDonate, isCommand, Response } from '../types/commands'

export default class WorkerProcessingEngine implements ProcessingEngine {
sessionId: String
Expand Down Expand Up @@ -60,9 +60,8 @@ export default class WorkerProcessingEngine implements ProcessingEngine {
console.log('[WorkerProcessingEngine] started')

const waitForInitialization: Promise<void> = this.waitForInitialization()
const waitForSplashScreen: Promise<void> = this.waitForSplashScreen()

Promise.all([waitForInitialization, waitForSplashScreen]).then(
waitForInitialization.then(
() => { this.firstRunCycle() },
() => {}
)
Expand All @@ -75,23 +74,6 @@ export default class WorkerProcessingEngine implements ProcessingEngine {
})
}

async waitForSplashScreen (): Promise<void> {
return await new Promise<void>((resolve) => {
this.resolveContinue = resolve
this.renderSplashScreen()
})
}

renderSplashScreen (): void {
const command: CommandUIRender = { __type__: 'CommandUIRender', page: { __type__: 'PropsUIPageSplashScreen' } }
if (isCommand(command)) {
this.commandHandler.onCommand(command).then(
(_response) => this.resolveContinue(),
() => {}
)
}
}

firstRunCycle (): void {
this.worker.postMessage({ eventType: 'firstRunCycle', sessionId: this.sessionId })
}
Expand Down
4 changes: 0 additions & 4 deletions src/framework/types/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export type PropsUIPage =

export function isPropsUIPage (arg: any): arg is PropsUIPage {
return (
isPropsUIPageSplashScreen(arg) ||
isPropsUIPageDonation(arg) ||
isPropsUIPageEnd(arg)
)
Expand All @@ -18,9 +17,6 @@ export function isPropsUIPage (arg: any): arg is PropsUIPage {
export interface PropsUIPageSplashScreen {
__type__: 'PropsUIPageSplashScreen'
}
export function isPropsUIPageSplashScreen (arg: any): arg is PropsUIPageSplashScreen {
return isInstanceOf<PropsUIPageSplashScreen>(arg, 'PropsUIPageSplashScreen', [])
}

export interface PropsUIPageDonation {
__type__: 'PropsUIPageDonation'
Expand Down
6 changes: 1 addition & 5 deletions src/framework/visualisation/react/factory.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@

import { EndPage } from './ui/pages/end_page'
import { isPropsUIPageEnd, isPropsUIPageDonation, PropsUIPage, isPropsUIPageSplashScreen } from '../../types/pages'
import { isPropsUIPageEnd, isPropsUIPageDonation, PropsUIPage } from '../../types/pages'
import { DonationPage } from './ui/pages/donation_page'
import { Payload } from '../../types/commands'
import { SplashScreen } from './ui/pages/splash_screen'

export interface ReactFactoryContext {
locale: string
Expand All @@ -12,9 +11,6 @@ export interface ReactFactoryContext {

export default class ReactFactory {
createPage (page: PropsUIPage, context: ReactFactoryContext): JSX.Element {
if (isPropsUIPageSplashScreen(page)) {
return <SplashScreen {...page} {...context} />
}
if (isPropsUIPageEnd(page)) {
return <EndPage {...page} {...context} />
}
Expand Down
37 changes: 2 additions & 35 deletions src/framework/visualisation/react/ui/pages/donation_page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,18 @@ import { Translatable } from '../../../../types/elements'
import { PropsUIPageDonation } from '../../../../types/pages'
import { isPropsUIPromptConfirm, isPropsUIPromptConsentForm, isPropsUIPromptFileInput, isPropsUIPromptRadioInput } from '../../../../types/prompts'
import { ReactFactoryContext } from '../../factory'
import { ForwardButton } from '../elements/button'
import { Title1 } from '../elements/text'
import { Confirm } from '../prompts/confirm'
import { ConsentForm } from '../prompts/consent_form'
import { FileInput } from '../prompts/file_input'
import { RadioInput } from '../prompts/radio_input'
import { Footer } from './templates/footer'
import { Sidebar } from './templates/sidebar'
import LogoSvg from '../../../../../assets/images/logo.svg'
import { Page } from './templates/page'
import { Progress } from '../elements/progress'
import { Instructions } from '../elements/instructions'

type Props = Weak<PropsUIPageDonation> & ReactFactoryContext

export const DonationPage = (props: Props): JSX.Element => {
const { title, forwardButton } = prepareCopy(props)
const { platform, locale, resolve } = props
const { title } = prepareCopy(props)
const { locale } = props

function renderBody (props: Props): JSX.Element {
const context = { locale: locale, resolve: props.resolve }
Expand All @@ -43,31 +37,6 @@ export const DonationPage = (props: Props): JSX.Element => {
throw new TypeError('Unknown body type')
}

function handleSkip (): void {
resolve?.({ __type__: 'PayloadFalse', value: false })
}

const footer: JSX.Element = (
<Footer
middle={<Progress percentage={props.footer.progressPercentage} />}
right={
<div className='flex flex-row'>
<div className='flex-grow' />
<ForwardButton label={forwardButton} onClick={handleSkip} />
</div>
}
/>
)

const sidebar: JSX.Element = (
<Sidebar
logo={LogoSvg}
content={
<Instructions platform={platform} locale={locale} />
}
/>
)

const body: JSX.Element = (
<>
<Title1 text={title} />
Expand All @@ -78,8 +47,6 @@ export const DonationPage = (props: Props): JSX.Element => {
return (
<Page
body={body}
sidebar={sidebar}
footer={footer}
/>
)
}
Expand Down
9 changes: 0 additions & 9 deletions src/framework/visualisation/react/ui/pages/end_page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { Weak } from '../../../../helpers'
import { PropsUIPageEnd } from '../../../../types/pages'
import { ReactFactoryContext } from '../../factory'
import { Footer } from './templates/footer'
import { Sidebar } from './templates/sidebar'
import LogoSvg from '../../../../../assets/images/logo.svg'
import { Page } from './templates/page'
import TextBundle from '../../../../text_bundle'
import { Translator } from '../../../../translator'
Expand All @@ -14,10 +11,6 @@ type Props = Weak<PropsUIPageEnd> & ReactFactoryContext
export const EndPage = (props: Props): JSX.Element => {
const { title, text } = prepareCopy(props)

const footer: JSX.Element = <Footer />

const sidebar: JSX.Element = <Sidebar logo={LogoSvg} />

const body: JSX.Element = (
<>
<Title1 text={title} />
Expand All @@ -28,8 +21,6 @@ export const EndPage = (props: Props): JSX.Element => {
return (
<Page
body={body}
sidebar={sidebar}
footer={footer}
/>
)
}
Expand Down
153 changes: 0 additions & 153 deletions src/framework/visualisation/react/ui/pages/splash_screen.tsx

This file was deleted.

36 changes: 0 additions & 36 deletions src/framework/visualisation/react/ui/pages/templates/footer.tsx

This file was deleted.

17 changes: 2 additions & 15 deletions src/framework/visualisation/react/ui/pages/templates/page.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
interface PageProps {
body: JSX.Element
sidebar: JSX.Element
footer: JSX.Element
}

export const Page = (props: PageProps): JSX.Element => {
return (
<div className='flex flex-col w-full h-full gap-4'>
<div className='flex flex-row w-full gap-10 pt-20 pr-14'>
<div className='flex-1 pl-14'>
{props.body}
</div>
<div className='w-sidebar flex-shrink-0'>
{props.sidebar}
</div>
</div>
<div className='flex-grow' />
<div className='h-footer flex-shrink-0'>
{props.footer}
</div>
<div className='w-full h-full'>
{props.body}
</div>
)
}
Loading

0 comments on commit 784fca5

Please sign in to comment.