From 917ce318085d2c04a801e98170b1df367542a83f Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Wed, 23 Oct 2019 21:48:47 -0700 Subject: [PATCH 1/3] Apply ignoreForNow --- scripts/lib/initialExpressionContainers.ts | 20 ++++---- scripts/lib/runnerConfigs.ts | 10 ++-- src/components/H.tsx | 8 ++++ src/components/Runners/index.ts | 2 +- src/components/VariableExpressionBox.tsx | 18 ++++++++ src/contents/14.jp.tsx | 53 +++++++--------------- src/lib/letterEmojiMappingJson.json | 1 + src/lib/runners/afoh.json | 2 +- src/lib/runners/amjx.json | 2 +- src/lib/runners/avsl.json | 2 +- src/lib/runners/cyyp.json | 4 +- src/lib/runners/fkat.json | 4 +- src/lib/runners/fkqu.json | 2 +- src/lib/runners/kdgv.json | 2 +- src/lib/runners/kosw.json | 2 +- src/lib/runners/mibj.json | 2 +- src/lib/runners/msrk.json | 2 +- src/lib/runners/ngxc.json | 4 +- src/lib/runners/qgau.json | 2 +- src/lib/runners/toem.json | 4 +- src/lib/runners/wjwu.json | 2 +- src/lib/runners/ysxf.json | 2 +- src/lib/runners/yyfi.json | 4 +- src/types/VariableNames.ts | 1 + 24 files changed, 81 insertions(+), 74 deletions(-) diff --git a/scripts/lib/initialExpressionContainers.ts b/scripts/lib/initialExpressionContainers.ts index 72101ba6c..aeebca68f 100644 --- a/scripts/lib/initialExpressionContainers.ts +++ b/scripts/lib/initialExpressionContainers.ts @@ -1561,7 +1561,7 @@ export const reak = initializeExpressionContainer({ }, falseCase: [ { shorthandFunc: 'add' }, - ['bentoBox', [{ shorthandFunc: 'pred' }, { shorthandNumber: 3 }]] + ['ignoreForNow', [{ shorthandFunc: 'pred' }, { shorthandNumber: 3 }]] ] }) @@ -1576,7 +1576,7 @@ export const edye = initializeExpressionContainer({ }, falseCase: [ { shorthandFunc: 'add' }, - ['bentoBox', [{ shorthandFunc: 'pred' }, { shorthandNumber: 3 }]] + ['ignoreForNow', [{ shorthandFunc: 'pred' }, { shorthandNumber: 3 }]] ] }) @@ -1593,7 +1593,7 @@ export const nrff = initializeExpressionContainer([ falseCase: [ { shorthandFunc: 'add' }, [ - 'bentoBox', + 'ignoreForNow', [ { shorthandFunc: 'pred' }, [{ shorthandFunc: 'pred' }, { shorthandNumber: 3 }] @@ -1617,7 +1617,7 @@ export const twpb = initializeExpressionContainer([ falseCase: [ { shorthandFunc: 'add' }, [ - 'bentoBox', + 'ignoreForNow', [ { shorthandFunc: 'pred', initialHighlight: true }, [{ shorthandFunc: 'pred' }, { shorthandNumber: 3 }] @@ -1642,7 +1642,7 @@ export const tsjd = initializeExpressionContainer([ falseCase: [ { shorthandFunc: 'add' }, [ - 'bentoBox', + 'ignoreForNow', [ { shorthandFunc: 'pred' }, [ @@ -1670,7 +1670,7 @@ export const qojl = initializeExpressionContainer([ falseCase: [ { shorthandFunc: 'add' }, [ - 'bentoBox', + 'ignoreForNow', [ { shorthandFunc: 'pred' }, [{ shorthandFunc: 'pred' }, { shorthandNumber: 3 }] @@ -1696,7 +1696,7 @@ export const zxhp = initializeExpressionContainer([ falseCase: [ { shorthandFunc: 'add' }, [ - 'bentoBox', + 'ignoreForNow', [ { shorthandFunc: 'pred', initialHighlight: true }, [ @@ -1727,7 +1727,7 @@ export const ihdu = initializeExpressionContainer([ falseCase: [ { shorthandFunc: 'add' }, [ - 'bentoBox', + 'ignoreForNow', [ { shorthandFunc: 'pred' }, [ @@ -1763,7 +1763,7 @@ export const npmi = initializeExpressionContainer([ falseCase: [ { shorthandFunc: 'add' }, [ - 'bentoBox', + 'ignoreForNow', [ { shorthandFunc: 'pred', initialHighlight: true }, [ @@ -1797,7 +1797,7 @@ export const znga = initializeExpressionContainer([ falseCase: [ { shorthandFunc: 'add' }, [ - 'bentoBox', + 'ignoreForNow', [ { shorthandFunc: 'pred' }, [ diff --git a/scripts/lib/runnerConfigs.ts b/scripts/lib/runnerConfigs.ts index 10f64a88c..55d400fd1 100644 --- a/scripts/lib/runnerConfigs.ts +++ b/scripts/lib/runnerConfigs.ts @@ -2094,7 +2094,7 @@ export const yyfi: ExpressionRunnerShorthandConfig = { skipActive: true, initialExpressionContainer: initialExpressionContainers.reak, showPriorities: true, - highlightOverrides: { bentoBox: 'highlighted' } + highlightOverrides: { ignoreForNow: 'highlighted' } } export const amjx: ExpressionRunnerShorthandConfig = { @@ -2137,7 +2137,7 @@ export const ngxc: ExpressionRunnerShorthandConfig = { showPriorities: true, initialState: 'default', nextIterations: 1, - highlightOverrides: { bentoBox: 'highlighted' }, + highlightOverrides: { ignoreForNow: 'highlighted' }, explanationsVisibility: 'hidden' } @@ -2176,7 +2176,7 @@ export const fkat: ExpressionRunnerShorthandConfig = { skipActive: true, initialExpressionContainer: initialExpressionContainers.nrff, showPriorities: true, - highlightOverrides: { bentoBox: 'highlighted' }, + highlightOverrides: { ignoreForNow: 'highlighted' }, explanationsVisibility: 'hidden' } @@ -2215,7 +2215,7 @@ export const cyyp: ExpressionRunnerShorthandConfig = { initialExpressionContainer: initialExpressionContainers.tsjd, showPriorities: true, explanationsVisibility: 'hidden', - highlightOverrides: { bentoBox: 'highlighted' } + highlightOverrides: { ignoreForNow: 'highlighted' } } export const kosw: ExpressionRunnerShorthandConfig = { @@ -2261,7 +2261,7 @@ export const toem: ExpressionRunnerShorthandConfig = { initialExpressionContainer: initialExpressionContainers.ihdu, showPriorities: true, explanationsVisibility: 'hidden', - highlightOverrides: { bentoBox: 'highlighted' } + highlightOverrides: { ignoreForNow: 'highlighted' } } export const kdgv: ExpressionRunnerShorthandConfig = { diff --git a/src/components/H.tsx b/src/components/H.tsx index 1cd265768..61410648a 100644 --- a/src/components/H.tsx +++ b/src/components/H.tsx @@ -164,6 +164,7 @@ interface HProps { | { name: 'demoTitle' } | { name: 'whatTheNumberIsCaption' } | { name: 'runAndShowAllSteps' } + | { name: 'ignoreForNow' } } const H = ({ args, highlightType, episodeNumberOverrides }: HProps) => { @@ -1653,6 +1654,13 @@ const H = ({ args, highlightType, episodeNumberOverrides }: HProps) => { ) } } + if (args.name === 'ignoreForNow') { + if (locale === 'en') { + return <>(Ignore for Now) + } else { + return <>(一時的に省略) + } + } throw new Error() } diff --git a/src/components/Runners/index.ts b/src/components/Runners/index.ts index 317be9235..d206ba7e5 100644 --- a/src/components/Runners/index.ts +++ b/src/components/Runners/index.ts @@ -234,7 +234,6 @@ export { default as Fsgq } from 'src/components/Runners/Fsgq' export { default as Gvxz } from 'src/components/Runners/Gvxz' export { default as Xqjd } from 'src/components/Runners/Xqjd' export { default as Cldb } from 'src/components/Runners/Cldb' -export { default as Dqdv } from 'src/components/Runners/Dqdv' export { default as Ylav } from 'src/components/Runners/Ylav' export { default as Sldg } from 'src/components/Runners/Sldg' export { default as Dtle } from 'src/components/Runners/Dtle' @@ -364,3 +363,4 @@ export { default as Txxw } from 'src/components/Runners/Txxw' export { default as Eijx } from 'src/components/Runners/Eijx' export { default as Kmgw } from 'src/components/Runners/Kmgw' export { default as Xbki } from 'src/components/Runners/Xbki' +export { default as Dqdv } from 'src/components/Runners/Dqdv' diff --git a/src/components/VariableExpressionBox.tsx b/src/components/VariableExpressionBox.tsx index a7a33ad6d..94fcd8ab5 100644 --- a/src/components/VariableExpressionBox.tsx +++ b/src/components/VariableExpressionBox.tsx @@ -262,6 +262,24 @@ const VariableEmoji = ({ expression }: VariableExpressionBoxProps) => { ) + } else if (expression.name === 'ignoreForNow') { + return ( +
+ + + +
+ ) } else { return ( ( children: ( <>

- 黄色の部分が複雑なので、 - - - 分かりやすくするために、 - - そこだけを 🍱{' '} - のアイコンに置き換えて省略してみると、下のようになる - - よ。 + 黄色の部分は、今は関係ないので、見やすくするために + 一時的に省略してみるね。

+

すると、下のようになるよ。

) } @@ -276,7 +270,7 @@ export default () => ( /> 先ほどの弁当箱の黄色の部分
- 🍱 と置き換えて省略します + 一時的に省略します
(複雑なので見やすくするため)
@@ -295,9 +289,9 @@ export default () => ( children: ( <>

- この 🍱 で省略した部分は、 + この省略した部分は、 - すぐに元に戻すけど、いったん省略したままにしておく + すぐに元に戻すけど、少しの間だけ省略したままにしておく ね。

@@ -332,18 +326,13 @@ export default () => ( type: 'saya', children: ( <> -

- じゃあ、🍱 を省略する前の状態( - 黄色の部分)に戻すね。 -

+

じゃあ、省略した部分を省略する前の状態に戻すね。

) } ]} /> - - 🍱 の部分を… - + 省略した部分を… 省略前の状態に戻す (

では、また - - 黄色の部分を 🍱{' '} - のアイコンで省略してみた - + 黄色の部分を省略してみた よ。前回と何が違うかな?

@@ -408,9 +394,7 @@ export default () => ( ]} /> - - 黄色の部分を 🍱 で省略してみた - + 黄色の部分を省略してみた ( children: ( <>

- 再度、🍱 を省略する前の状態に戻したよ。 + 再度、省略した部分を省略する前の状態に戻したよ。

@@ -547,8 +531,7 @@ export default () => ( <>

- また真ん中の部分が前回と同じなので、🍱{' '} - のアイコンで省略してみる + また真ん中の部分が前回と同じなので、省略してみる ね。

@@ -559,9 +542,7 @@ export default () => ( /> 黄色の部分は前回と同じなので… - - また 🍱 で省略してみた - + また省略してみた ( <>

これが最後だよ! - 🍱 を省略する前の状態に戻したので、 + 省略した部分を省略する前の状態に戻したので、

@@ -723,7 +704,7 @@ export default () => (

例によって、真ん中の部分が前回と同じなので、 - 🍱 のアイコンで省略してみる + 省略してみる ね。

@@ -734,9 +715,7 @@ export default () => ( /> 黄色の部分は前回と同じなので… - - また 🍱 で省略してみた - + また省略してみた Date: Wed, 23 Oct 2019 22:17:59 -0700 Subject: [PATCH 2/3] leftVerticalIndent --- .../ExpressionRunnerPrecomputed.tsx | 29 ++++++++++++++++++- src/components/H.tsx | 16 ++++++++-- src/components/TwoColContext.tsx | 2 ++ src/components/TwoColGrid.tsx | 19 ++++++++++-- src/components/VariableExpressionBox.tsx | 4 +-- src/contents/14.jp.tsx | 6 ++++ 6 files changed, 68 insertions(+), 8 deletions(-) diff --git a/src/components/ExpressionRunnerPrecomputed.tsx b/src/components/ExpressionRunnerPrecomputed.tsx index c436234f2..b7612cab3 100644 --- a/src/components/ExpressionRunnerPrecomputed.tsx +++ b/src/components/ExpressionRunnerPrecomputed.tsx @@ -24,6 +24,10 @@ import functionDepthsToContainerSize from 'src/lib/functionDepthsToContainerSize import CrossSvg from 'src/components/CrossSvg' import { LinkButton } from 'src/components/ContentTags/LinkButton' import TwoColContext from 'src/components/TwoColContext' +import { + p, + variableExpressionBoxFontSize +} from 'src/components/VariableExpressionBox' export interface ExpressionRunnerPrecomputedProps { expressionContainers: readonly SteppedExpressionContainer[] @@ -168,7 +172,9 @@ const ExpressionRunnerPrecomputed = ({ expressionContainers[currentIndex].numLeafNodes ) - const { maxVariableSize } = useContext(TwoColContext) + const { maxVariableSize, forceVariableSize, leftVerticalIndent } = useContext( + TwoColContext + ) if (maxVariableSize) { if (maxVariableSize === 'md' && variableSize === 'lg') { @@ -181,6 +187,10 @@ const ExpressionRunnerPrecomputed = ({ } } + if (forceVariableSize) { + variableSize = forceVariableSize + } + return ( + {leftVerticalIndent && ( +
+
+
+ )}
{ } if (args.name === 'ignoreForNow') { if (locale === 'en') { - return <>(Ignore for Now) + return ( + <> + Ignore +
+ for Now + + ) } else { - return <>(一時的に省略) + return ( + <> + 一時的に +
+ 省略 + + ) } } throw new Error() diff --git a/src/components/TwoColContext.tsx b/src/components/TwoColContext.tsx index 63551ac3a..715bab2e5 100644 --- a/src/components/TwoColContext.tsx +++ b/src/components/TwoColContext.tsx @@ -2,6 +2,8 @@ import React from 'react' export interface TwoColContextProps { maxVariableSize?: 'sm' | 'md' + forceVariableSize?: 'xs' | 'sm' | 'md' + leftVerticalIndent?: true } export const twoColContext: TwoColContextProps = {} diff --git a/src/components/TwoColGrid.tsx b/src/components/TwoColGrid.tsx index a5fe6bd53..116ae78c1 100644 --- a/src/components/TwoColGrid.tsx +++ b/src/components/TwoColGrid.tsx @@ -9,17 +9,22 @@ const TwoColGrid = ({ right, noTopNegativeMargin, noBottomNegativeMargin, - maxVariableSize + maxVariableSize, + forceVariableSize, + leftVerticalIndent }: { left: React.ReactNode right: React.ReactNode noTopNegativeMargin?: boolean noBottomNegativeMargin?: boolean maxVariableSize: TwoColContextProps['maxVariableSize'] + forceVariableSize?: TwoColContextProps['forceVariableSize'] + leftVerticalIndent?: TwoColContextProps['leftVerticalIndent'] }) => ( - {left} + + {left} +
{ font-weight: bold; text-align: center; display: block; - font-size: 0.5em; - padding: 0.4em 0; + font-size: 0.55em; + padding: 0.2em 0; ` ]} > diff --git a/src/contents/14.jp.tsx b/src/contents/14.jp.tsx index c13606337..4b3c4e4ea 100644 --- a/src/contents/14.jp.tsx +++ b/src/contents/14.jp.tsx @@ -409,6 +409,8 @@ export default () => ( ]} /> @@ -556,6 +558,8 @@ export default () => ( ]} /> @@ -729,6 +733,8 @@ export default () => ( ]} /> From 085bb3220939de09139e7ad6454685706d554f62 Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Wed, 23 Oct 2019 22:24:55 -0700 Subject: [PATCH 3/3] Update 14 --- src/contents/14.en.tsx | 70 ++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 43 deletions(-) diff --git a/src/contents/14.en.tsx b/src/contents/14.en.tsx index 780f5a15c..72f68bfa0 100644 --- a/src/contents/14.en.tsx +++ b/src/contents/14.en.tsx @@ -248,29 +248,23 @@ export default () => ( <>

- This yellow section is complicated, so let’s make it - simple: - + We don’t need to worry about this yellow section for + now, so: + {' '} + + Let’s ignore this section for now. +

- - Let’s replace the yellow section with the{' '} - 🍱 icon - {' '} - to make it look simple. + We’ll replace with the “Ignore for Now”{' '} + sign:

) } ]} /> - - Replace the yellow section -
- with the 🍱 icon -
- (For simplicity only) -
+ Ignore the yellow section for now ( children: ( <>

- We’ll undo this replacement with the 🍱{' '} - icon later, but for now, let’s use the 🍱{' '} - icon to make it look simple. + We’ll undo this later, but let’s ignore this section for + now.

Anyway, let’s continue:{' '} @@ -321,18 +314,13 @@ export default () => ( type: 'saya', children: ( <> -

- じゃあ、🍱 を省略する前の状態( - 黄色の部分)に戻すね。 -

+

じゃあ、省略した部分を省略する前の状態に戻すね。

) } ]} /> - - 🍱 の部分を… - + 省略した部分を… 省略前の状態に戻す (

では、また - - 黄色の部分を 🍱{' '} - のアイコンで省略してみた - + 黄色の部分を省略してみた よ。前回と何が違うかな?

@@ -397,9 +382,7 @@ export default () => ( ]} /> - - 黄色の部分を 🍱 で省略してみた - + 黄色の部分を省略してみた ( ]} /> @@ -519,7 +504,7 @@ export default () => ( children: ( <>

- 再度、🍱 を省略する前の状態に戻したよ。 + 再度、省略した部分を省略する前の状態に戻したよ。

@@ -536,8 +521,7 @@ export default () => ( <>

- また真ん中の部分が前回と同じなので、🍱{' '} - のアイコンで省略してみる + また真ん中の部分が前回と同じなので、省略してみる ね。

@@ -548,9 +532,7 @@ export default () => ( /> 黄色の部分は前回と同じなので… - - また 🍱 で省略してみた - + また省略してみた ( ]} /> @@ -694,7 +678,7 @@ export default () => ( <>

これが最後だよ! - 🍱 を省略する前の状態に戻したので、 + 省略した部分を省略する前の状態に戻したので、

@@ -712,7 +696,7 @@ export default () => (

例によって、真ん中の部分が前回と同じなので、 - 🍱 のアイコンで省略してみる + 省略してみる ね。

@@ -723,9 +707,7 @@ export default () => ( /> 黄色の部分は前回と同じなので… - - また 🍱 で省略してみた - + また省略してみた ( ]} />