-
Notifications
You must be signed in to change notification settings - Fork 5
Port takeover-dialog files to TypeScript #2790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
cac4a4a
Port takeover-dialog JS files to TypeScript
OpenStaxClaude 1db5f18
Define TakeoverData once; fix lint issues
RoyEJohnson 9364a28
Tests
RoyEJohnson 5325329
Coverage for phone-view
RoyEJohnson d1e123a
Remove overlapping-quote section from Assignable page
RoyEJohnson 55ce981
Cover no PDF link case
RoyEJohnson f2f17cd
Prettier
RoyEJohnson dc3e721
De-optionalize fields
RoyEJohnson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
79 changes: 0 additions & 79 deletions
79
src/app/layouts/default/takeover-dialog/content-desktop.js
This file was deleted.
Oops, something went wrong.
128 changes: 128 additions & 0 deletions
128
src/app/layouts/default/takeover-dialog/content-desktop.tsx
This file contains hidden or 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,128 @@ | ||
| import React from 'react'; | ||
| import RawHTML from '~/components/jsx-helpers/raw-html'; | ||
| import {Countdown, Amount, GiveButton, TakeoverData} from './common'; | ||
| import './content-desktop.scss'; | ||
|
|
||
| function Logo() { | ||
| return ( | ||
| <img | ||
| className="logo-color" | ||
| src="/dist/images/logo.svg" | ||
| alt="OpenStax logo" | ||
| width="354" | ||
| height="81" | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| function Basic({ | ||
| headline, | ||
| message, | ||
| image, | ||
| children | ||
| }: { | ||
| headline: string; | ||
| message: string; | ||
| image: string; | ||
| children?: React.ReactNode; | ||
| }) { | ||
| return ( | ||
| <div className="takeover-content desktop-only"> | ||
| <div className="text-side"> | ||
| <Logo /> | ||
| <RawHTML Tag="h1" html={headline} id="takeover-headline" /> | ||
| <div className="message">{message}</div> | ||
| {children} | ||
| </div> | ||
| <div | ||
| className="picture-side" | ||
| style={{backgroundImage: `url(${image})`}} | ||
| /> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| function MessageBox({ | ||
| buttonText, | ||
| buttonUrl, | ||
| headline, | ||
| html | ||
| }: { | ||
| buttonText: string; | ||
| buttonUrl: string; | ||
| headline: string; | ||
| html: string; | ||
| }) { | ||
| return ( | ||
| <React.Fragment> | ||
| <GiveButton text={buttonText} url={buttonUrl} /> | ||
| <div className="message-box"> | ||
| <div className="color-fill" /> | ||
| <div className="text-content"> | ||
| <h2>{headline}</h2> | ||
| <RawHTML html={html} /> | ||
| </div> | ||
| </div> | ||
| </React.Fragment> | ||
| ); | ||
| } | ||
|
|
||
| function GoalBox({ | ||
| buttonText, | ||
| buttonUrl, | ||
| goalAmount, | ||
| goalTime | ||
| }: { | ||
| buttonText: string; | ||
| buttonUrl: string; | ||
| goalAmount: number; | ||
| goalTime: string; | ||
| }) { | ||
| return ( | ||
| <div className="goal-box"> | ||
| <Amount amount={goalAmount} /> | ||
| <div className="timer-side"> | ||
| <a className="btn primary" href={buttonUrl}> | ||
| {buttonText} | ||
| </a> | ||
| <div className="message">help us meet our goal in the next</div> | ||
| <Countdown goalTime={goalTime} /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| function Box({data}: {data: TakeoverData}) { | ||
| return ( | ||
| { | ||
| message: ( | ||
| <MessageBox | ||
| buttonText={data.buttonText} | ||
| buttonUrl={data.buttonUrl} | ||
| headline={data.boxHeadline} | ||
| html={data.boxHtml} | ||
| /> | ||
| ), | ||
| goal: ( | ||
| <GoalBox | ||
| buttonText={data.buttonText} | ||
| buttonUrl={data.buttonUrl} | ||
| goalAmount={data.goalAmount!} | ||
| goalTime={data.goalTime} | ||
| /> | ||
| ) | ||
| }[data.messageType] || <h1>OOPS, {data.messageType}</h1> | ||
| ); | ||
| } | ||
|
|
||
| export default function DesktopContent({data}: {data: TakeoverData}) { | ||
| return ( | ||
| <Basic | ||
| headline={data.headline} | ||
| message={data.message} | ||
| image={data.image} | ||
| > | ||
| <Box data={data} /> | ||
| </Basic> | ||
| ); | ||
| } |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the first commit for the real changes for all the files in the takeover-dialog folder. It's all just adding types. The final commit is prettier, which is what changed the file enough that it registered as delete-and-create.