Misc fixes ported from #5814

This commit is contained in:
Tom Moor
2024-01-24 22:43:10 -05:00
parent df816c200f
commit cab9a1ec96
5 changed files with 24 additions and 8 deletions

View File

@@ -70,6 +70,7 @@ const SearchInput = styled(KBarSearch)`
&:disabled, &:disabled,
&::placeholder { &::placeholder {
color: ${s("placeholder")}; color: ${s("placeholder")};
opacity: 1;
} }
`; `;

View File

@@ -8,7 +8,7 @@ import Flex from "~/components/Flex";
import Text from "~/components/Text"; import Text from "~/components/Text";
import { undraggableOnDesktop } from "~/styles"; import { undraggableOnDesktop } from "~/styles";
const RealTextarea = styled.textarea<{ hasIcon?: boolean }>` export const NativeTextarea = styled.textarea<{ hasIcon?: boolean }>`
border: 0; border: 0;
flex: 1; flex: 1;
padding: 8px 12px 8px ${(props) => (props.hasIcon ? "8px" : "12px")}; padding: 8px 12px 8px ${(props) => (props.hasIcon ? "8px" : "12px")};
@@ -19,10 +19,11 @@ const RealTextarea = styled.textarea<{ hasIcon?: boolean }>`
&:disabled, &:disabled,
&::placeholder { &::placeholder {
color: ${s("placeholder")}; color: ${s("placeholder")};
opacity: 1;
} }
`; `;
const RealInput = styled.input<{ hasIcon?: boolean }>` export const NativeInput = styled.input<{ hasIcon?: boolean }>`
border: 0; border: 0;
flex: 1; flex: 1;
padding: 8px 12px 8px ${(props) => (props.hasIcon ? "8px" : "12px")}; padding: 8px 12px 8px ${(props) => (props.hasIcon ? "8px" : "12px")};
@@ -39,6 +40,7 @@ const RealInput = styled.input<{ hasIcon?: boolean }>`
&:disabled, &:disabled,
&::placeholder { &::placeholder {
color: ${s("placeholder")}; color: ${s("placeholder")};
opacity: 1;
} }
&:-webkit-autofill, &:-webkit-autofill,
@@ -56,7 +58,7 @@ const RealInput = styled.input<{ hasIcon?: boolean }>`
`}; `};
`; `;
const Wrapper = styled.div<{ export const Wrapper = styled.div<{
flex?: boolean; flex?: boolean;
short?: boolean; short?: boolean;
minHeight?: number; minHeight?: number;
@@ -205,7 +207,7 @@ function Input(
<Outline focused={focused} margin={margin}> <Outline focused={focused} margin={margin}>
{icon && <IconWrapper>{icon}</IconWrapper>} {icon && <IconWrapper>{icon}</IconWrapper>}
{type === "textarea" ? ( {type === "textarea" ? (
<RealTextarea <NativeTextarea
ref={mergeRefs([ ref={mergeRefs([
internalRef, internalRef,
ref as React.RefObject<HTMLTextAreaElement>, ref as React.RefObject<HTMLTextAreaElement>,
@@ -217,7 +219,7 @@ function Input(
{...rest} {...rest}
/> />
) : ( ) : (
<RealInput <NativeInput
ref={mergeRefs([ ref={mergeRefs([
internalRef, internalRef,
ref as React.RefObject<HTMLInputElement>, ref as React.RefObject<HTMLInputElement>,

View File

@@ -78,6 +78,7 @@ const Wrapper = styled.a<{
}>` }>`
display: flex; display: flex;
padding: ${(props) => (props.$border === false ? 0 : "8px 0")}; padding: ${(props) => (props.$border === false ? 0 : "8px 0")};
min-height: 32px;
margin: ${(props) => margin: ${(props) =>
props.$border === false ? (props.$small ? "8px 0" : "16px 0") : 0}; props.$border === false ? (props.$small ? "8px 0" : "16px 0") : 0};
border-bottom: 1px solid border-bottom: 1px solid

View File

@@ -64,7 +64,14 @@ function Switch({
<InlineLabelText>{label}</InlineLabelText> <InlineLabelText>{label}</InlineLabelText>
</Label> </Label>
{note && ( {note && (
<Text type="secondary" size="small"> <Text
type="secondary"
size="small"
style={{
paddingRight: labelPosition === "left" ? width : 0,
paddingLeft: labelPosition === "right" ? width : 0,
}}
>
{note} {note}
</Text> </Text>
)} )}

View File

@@ -44,6 +44,7 @@ export default abstract class Model {
if (!relations) { if (!relations) {
return; return;
} }
// this is to ensure that multiple loads dont happen in parallel
if (this.loadingRelations) { if (this.loadingRelations) {
return this.loadingRelations; return this.loadingRelations;
} }
@@ -64,8 +65,12 @@ export default abstract class Model {
promises.push(this.store.fetch(this.id, { force: true })); promises.push(this.store.fetch(this.id, { force: true }));
} }
this.loadingRelations = Promise.all(promises); try {
return await this.loadingRelations; this.loadingRelations = Promise.all(promises);
return await this.loadingRelations;
} finally {
this.loadingRelations = undefined;
}
} }
/** /**