Skip to content

Commit

Permalink
move isInLineGroup to class scope
Browse files Browse the repository at this point in the history
  • Loading branch information
fsimonjetz committed Jul 31, 2024
1 parent f74217f commit 76e0c08
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/transliteration/domain/columns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export function lineAccFromColumns({
acc.addColumnToken(
token,
index,
isInLineGroup,
showMeter,
showIpa,
updatePhoneticPropsContext(column.content, index, phoneticProps),
Expand All @@ -72,7 +71,7 @@ export function lineAccFromColumns({
acc
)
return acc
}, new LineAccumulator())
}, new LineAccumulator(isInLineGroup))
}

export function numberOfColumns(columns: readonly TextLineColumn[]): number {
Expand Down
10 changes: 6 additions & 4 deletions src/transliteration/ui/LineAccumulator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,13 @@ export class LineAccumulator {
private enclosureOpened = false
private protocol: Protocol | null = null
private isFirstWord = true
private isInLineGroup = false
lemmas: string[] = []

constructor(isInLineGroup?: boolean) {
this.isInLineGroup = isInLineGroup || false
}

getColumns(maxColumns: number): React.ReactNode[] {
return this.columns.map((column: ColumnData, index: number) => (
<td key={index} colSpan={column.span ?? maxColumns}>
Expand Down Expand Up @@ -87,7 +92,6 @@ export class LineAccumulator {
pushToken(
token: Token,
index: number,
isInLineGroup = false,
showMeter = false,
showIpa = false,
phoneticProps?: PhoneticProps,
Expand All @@ -100,7 +104,7 @@ export class LineAccumulator {
this.pushSeparator()
}

const DisplayTokenComponent = isInLineGroup
const DisplayTokenComponent = this.isInLineGroup
? DisplayLineGroupToken
: DisplayToken

Expand Down Expand Up @@ -139,7 +143,6 @@ export class LineAccumulator {
addColumnToken(
token: Token,
index: number,
isInLineGroup?: boolean,
showMeter?: boolean,
showIpa?: boolean,
phoneticProps?: PhoneticProps,
Expand All @@ -161,7 +164,6 @@ export class LineAccumulator {
this.pushToken(
token,
index,
isInLineGroup,
showMeter,
showIpa,
phoneticProps,
Expand Down
1 change: 0 additions & 1 deletion src/transliteration/ui/line-tokens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export function LineTokens({
index,
false,
false,
false,
{},
highlightTokens.includes(index) ? ['highlight'] : []
)
Expand Down

0 comments on commit 76e0c08

Please sign in to comment.