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 initial = (json: any, state: GroupState): GroupState => {
|
||||||
const data = json.initial;
|
const data = json.initial;
|
||||||
if(data) {
|
if(data) {
|
||||||
|
console.log(data);
|
||||||
state.pendingJoin = data;
|
state.pendingJoin = data;
|
||||||
}
|
}
|
||||||
return state;
|
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 progress = (json: any, state: GroupState): GroupState => {
|
||||||
const data = json.progress;
|
const data = json.progress;
|
||||||
if(data) {
|
if(data) {
|
||||||
|
console.log(data);
|
||||||
const { progress, resource } = data;
|
const { progress, resource } = data;
|
||||||
state.pendingJoin[resource].progress = progress;
|
state.pendingJoin[resource].progress = progress;
|
||||||
if(progress === 'done') {
|
if(progress === 'done') {
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
delete state.pendingJoin[resource];
|
delete state.pendingJoin[resource];
|
||||||
}, 10000);
|
}, 10000);
|
||||||
@ -40,6 +52,7 @@ export const GroupViewReducer = (json: any) => {
|
|||||||
reduceState<GroupState, GroupUpdate>(useGroupState, data, [
|
reduceState<GroupState, GroupUpdate>(useGroupState, data, [
|
||||||
progress,
|
progress,
|
||||||
hide,
|
hide,
|
||||||
|
started,
|
||||||
initial
|
initial
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ export function InviteItem(props: InviteItemProps) {
|
|||||||
api={api}
|
api={api}
|
||||||
preview={preview}
|
preview={preview}
|
||||||
invite={invite}
|
invite={invite}
|
||||||
status={pendingJoin.progress}
|
status={pendingJoin}
|
||||||
{...handlers}
|
{...handlers}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -72,7 +72,7 @@ export function JoinGroup(props: JoinGroupProps): ReactElement {
|
|||||||
MetadataUpdatePreview | string | null
|
MetadataUpdatePreview | string | null
|
||||||
>(null);
|
>(null);
|
||||||
|
|
||||||
const waiter = useWaitForProps({ associations, groups }, _.isString(preview) ? 1 : 30000);
|
const waiter = useWaitForProps({ associations, groups }, _.isString(preview) ? 1 : 10);
|
||||||
|
|
||||||
const { query } = useQuery();
|
const { query } = useQuery();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user