mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-12 15:01:38 +03:00
interface: support %started update
This commit is contained in:
parent
95bf313ff9
commit
365f17f210
@ -6,17 +6,29 @@ import useGroupState, { GroupState } from '../state/group';
|
||||
const initial = (json: any, state: GroupState): GroupState => {
|
||||
const data = json.initial;
|
||||
if(data) {
|
||||
console.log(data);
|
||||
state.pendingJoin = data;
|
||||
}
|
||||
return state;
|
||||
};
|
||||
|
||||
const started = (json: any, state: GroupState): GroupState => {
|
||||
const data = json.started;
|
||||
if(data) {
|
||||
const { resource, request } = data;
|
||||
state.pendingJoin[resource] = request;
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
const progress = (json: any, state: GroupState): GroupState => {
|
||||
const data = json.progress;
|
||||
if(data) {
|
||||
console.log(data);
|
||||
const { progress, resource } = data;
|
||||
state.pendingJoin[resource].progress = progress;
|
||||
if(progress === 'done') {
|
||||
|
||||
setTimeout(() => {
|
||||
delete state.pendingJoin[resource];
|
||||
}, 10000);
|
||||
@ -40,6 +52,7 @@ export const GroupViewReducer = (json: any) => {
|
||||
reduceState<GroupState, GroupUpdate>(useGroupState, data, [
|
||||
progress,
|
||||
hide,
|
||||
started,
|
||||
initial
|
||||
]);
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ export function InviteItem(props: InviteItemProps) {
|
||||
api={api}
|
||||
preview={preview}
|
||||
invite={invite}
|
||||
status={pendingJoin.progress}
|
||||
status={pendingJoin}
|
||||
{...handlers}
|
||||
/>
|
||||
);
|
||||
|
@ -72,7 +72,7 @@ export function JoinGroup(props: JoinGroupProps): ReactElement {
|
||||
MetadataUpdatePreview | string | null
|
||||
>(null);
|
||||
|
||||
const waiter = useWaitForProps({ associations, groups }, _.isString(preview) ? 1 : 30000);
|
||||
const waiter = useWaitForProps({ associations, groups }, _.isString(preview) ? 1 : 10);
|
||||
|
||||
const { query } = useQuery();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user