Merge pull request #4565 from urbit/lf/grabbag

interface: grabbag of fixes
This commit is contained in:
matildepark 2021-03-08 21:36:34 -05:00 committed by GitHub
commit 898561ea30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 26 additions and 14 deletions

View File

@ -60,7 +60,7 @@ export default class SettingsStateZusettingsReducer{
getAll(json: any, state: SettingsStateZus) {
const data = _.get(json, 'all');
if(data) {
_.merge(state, data);
_.mergeWith(state, data, (obj, src) => _.isArray(src) ? src : undefined)
}
}

View File

@ -33,7 +33,7 @@ export function ViewProfile(props: any) {
/>
<ProfileStatus contact={contact} />
</ProfileControls>
<ProfileImages contact={contact} ship={ship} />
<ProfileImages key={ship} contact={contact} ship={ship} />
</ProfileHeader>
<Row pb={2} alignItems='center' width='100%'>
<Center width='100%'>

View File

@ -42,6 +42,8 @@ export default function CommentInput(props: CommentInputProps) {
validationSchema={formSchema}
onSubmit={props.onSubmit}
initialValues={initialValues}
validateOnBlur={false}
validateOnChange={false}
>
<Form>
<SubmitTextArea

View File

@ -21,6 +21,8 @@ interface DropdownProps {
options: ReactNode;
alignY: AlignY | AlignY[];
alignX: AlignX | AlignX[];
offsetX?: number;
offsetY?: number;
width?: string;
dropWidth?: string;
}
@ -37,7 +39,7 @@ const DropdownOptions = styled(Box)`
`;
export function Dropdown(props: DropdownProps): ReactElement {
const { children, options } = props;
const { children, options, offsetX = 0, offsetY = 0 } = props;
const dropdownRef = useRef<HTMLElement>(null);
const anchorRef = useRef<HTMLElement>(null);
const { pathname } = useLocation();
@ -45,7 +47,7 @@ export function Dropdown(props: DropdownProps): ReactElement {
const [coords, setCoords] = useState({});
const updatePos = useCallback(() => {
const newCoords = getRelativePosition(anchorRef.current, props.alignX, props.alignY);
const newCoords = getRelativePosition(anchorRef.current, props.alignX, props.alignY, offsetX, offsetY);
if(newCoords) {
setCoords(newCoords);
}

View File

@ -109,9 +109,9 @@ const StatusBar = (props) => {
alignY="top"
alignX="right"
flexShrink={'0'}
offsetY={-48}
options={
<Col
mt='6'
p='1'
backgroundColor="white"
color="washedGray"

View File

@ -151,12 +151,14 @@ export default class VirtualScroller<T> extends Component<VirtualScrollerProps<T
}
componentDidMount() {
if(true) {
this.updateVisible(0);
this.resetScroll();
this.loadRows(false);
return;
if(this.props.size < 100) {
this.loaded.top = true;
this.loaded.bottom = true;
}
this.updateVisible(0);
this.resetScroll();
this.loadRows(false);
}
// manipulate scrollbar manually, to dodge change detection
@ -478,9 +480,8 @@ export default class VirtualScroller<T> extends Component<VirtualScrollerProps<T
const transform = isTop ? 'scale3d(1, 1, 1)' : 'scale3d(1, -1, 1)';
const loaded = this.props.data.size > 0;
const atStart = loaded && this.props.data.peekLargest()?.[0].eq(visibleItems.peekLargest()?.[0] || bigInt.zero);
const atStart = (this.props.data.peekLargest()?.[0] ?? bigInt.zero).eq(visibleItems.peekLargest()?.[0] || bigInt.zero);
const atEnd = this.loaded.top;
return (

View File

@ -286,8 +286,15 @@ function Participant(props: {
const onKick = useCallback(async () => {
const resource = resourceFromPath(association.group);
await api.groups.remove(resource, [`~${contact.patp}`]);
}, [api, association]);
if(contact.pending) {
await api.groups.changePolicy(
resource,
{ invite: { removeInvites: [`~${contact.patp}`] } }
);
} else {
await api.groups.remove(resource, [`~${contact.patp}`]);
}
}, [api, contact, association]);
const avatar =
contact?.avatar !== null && !hideAvatars ? (