Skip to content

Commit

Permalink
Fixes the guest password field always visible when inviting a guest
Browse files Browse the repository at this point in the history
  • Loading branch information
mup committed Dec 11, 2024
1 parent 989eaa3 commit a9f8548
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import { createCustomEndTypeOptions, createIntervalValues, createRepeatRuleOptio
import { px, size } from "../../../../common/gui/size.js"
import { Card } from "../../../../common/gui/base/Card.js"
import { RadioGroup, RadioGroupAttrs, RadioGroupOption } from "../../../../common/gui/base/RadioGroup.js"
import { SingleLineTextField } from "../../../../common/gui/base/SingleLineTextField.js"
import { InputMode, SingleLineTextField } from "../../../../common/gui/base/SingleLineTextField.js"
import { Select, SelectAttributes } from "../../../../common/gui/base/Select.js"
import stream from "mithril/stream"
import { Divider } from "../../../../common/gui/Divider.js"
import { theme } from "../../../../common/gui/theme.js"
import { isApp } from "../../../../common/api/common/Env.js"

export type RepeatRuleEditorAttrs = {
model: CalendarEventWhenModel
Expand Down Expand Up @@ -220,12 +221,14 @@ export class RepeatRuleEditor implements Component<RepeatRuleEditorAttrs> {
options: this.intervalOptions,
noIcon: true,
expanded: true,
tabIndex: Number(TabIndex.Programmatic),
tabIndex: isApp() ? Number(TabIndex.Default) : Number(TabIndex.Programmatic),
classes: ["no-appearance"],
renderDisplay: () =>
m(SingleLineTextField, {
classes: ["border-radius-bottom-0"],
value: isNaN(this.repeatInterval) ? "" : this.repeatInterval.toString(),
inputMode: isApp() ? InputMode.NONE : InputMode.TEXT,
readonly: isApp(),
oninput: (val: string) => {
if (val !== "" && this.repeatInterval === Number(val)) {
return
Expand Down Expand Up @@ -300,12 +303,14 @@ export class RepeatRuleEditor implements Component<RepeatRuleEditorAttrs> {
options: this.occurrencesOptions,
noIcon: true,
expanded: true,
tabIndex: Number(TabIndex.Programmatic),
tabIndex: isApp() ? Number(TabIndex.Default) : Number(TabIndex.Programmatic),
classes: ["no-appearance"],
renderDisplay: () =>
m(SingleLineTextField, {
classes: ["tutaui-button-outline", "text-center", "border-content-message-bg"],
value: isNaN(this.repeatOccurrences) ? "" : this.repeatOccurrences.toString(),
inputMode: isApp() ? InputMode.NONE : InputMode.TEXT,
readonly: isApp(),
oninput: (val: string) => {
if (val !== "" && this.repeatOccurrences === Number(val)) {
return
Expand Down
11 changes: 11 additions & 0 deletions src/common/gui/base/SingleLineTextField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ import { TextFieldType } from "./TextField.js"
import { AllIcons, Icon, IconSize } from "./Icon.js"
import { px, size } from "../size.js"

export enum InputMode {
NONE = "none",
NUMERIC = "numeric",
TEXT = "text",
}

export interface SingleLineTextFieldAttrs<T extends TextFieldType> extends Pick<Component, "oncreate"> {
value: string | number
ariaLabel: string
Expand Down Expand Up @@ -30,6 +36,8 @@ export interface SingleLineTextFieldAttrs<T extends TextFieldType> extends Pick<
icon: AllIcons
color: string
}
inputMode?: InputMode
readonly?: boolean
}

export interface SingleLineNumberFieldAttrs<T extends TextFieldType> extends SingleLineTextFieldAttrs<T> {
Expand Down Expand Up @@ -126,6 +134,9 @@ export class SingleLineTextField<T extends TextFieldType> implements ClassCompon
...(inputPadding ? { paddingLeft: inputPadding } : {}),
...attrs.style,
},
type: attrs.inputMode === InputMode.NONE ? undefined : attrs.type,
inputMode: attrs.inputMode,
readonly: attrs.readonly,
...this.getInputProperties(attrs),
})
}
Expand Down

0 comments on commit a9f8548

Please sign in to comment.