types: fixing type issues from merge

This commit is contained in:
Hunter Miller 2022-01-07 11:08:59 -06:00
parent 9c5f90fe3b
commit 1ddc7fee83
10 changed files with 18653 additions and 1390 deletions

View File

@ -1,7 +1,7 @@
import useMetadataState from '../state/metadata';
import ob from 'urbit-ob';
import useInviteState from '../state/invite';
import {resourceAsPath} from '../../../../npm/api/dist';
import { resourceAsPath } from '@urbit/api/';
function getGroupResourceRedirect(key: string) {
const association = useMetadataState.getState().associations.graph[`/ship/${key}`];

View File

@ -2,11 +2,10 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react';
import _ from 'lodash';
import { patp2dec } from 'urbit-ob';
import f from 'lodash/fp';
import { Association, Contact, Patp } from '@urbit/api';
import { Association, Patp } from '@urbit/api';
import { enableMapSet } from 'immer';
/* eslint-disable max-lines */
import anyAscii from 'any-ascii';
import { sigil as sigiljs, stringRenderer } from '@tlon/sigil-js';
import bigInt, { BigInteger } from 'big-integer';
import { IconRef, Workspace } from '~/types';
@ -503,7 +502,6 @@ export const svgDataURL = svg => 'data:image/svg+xml;base64,' + btoa(svg);
export const svgBlobURL = svg => URL.createObjectURL(new Blob([svg], { type: 'image/svg+xml' }));
export function binaryIndexOf(arr: BigInteger[], target: BigInteger): number | undefined {
let leftBound = 0;
let rightBound = arr.length - 1;

View File

@ -69,5 +69,4 @@ export const favicon = () => {
return svg;
};
export default useContactState;

View File

@ -10,7 +10,7 @@ import { hot } from 'react-hot-loader/root';
import { Router, withRouter } from 'react-router-dom';
import styled, { ThemeProvider } from 'styled-components';
import gcpManager from '~/logic/lib/gcpManager';
import { favicon, svgDataURL } from '~/logic/lib/util';
import { svgDataURL } from '~/logic/lib/util';
import history from '~/logic/lib/history';
import withState from '~/logic/lib/withState';
import useContactState, { favicon } from '~/logic/state/contact';

View File

@ -1,7 +1,7 @@
import { Box, Center, Col, Text } from '@tlon/indigo-react';
import React from 'react';
import useHarkState, { HarkState } from '~/logic/state/hark';
import { harkBinToId, HarkLid, Timebox } from '../../../../../npm/api/dist';
import { harkBinToId, HarkLid, Timebox } from '@urbit/api';
import { Notification } from './notification';
const unseenLid = { unseen: null };

View File

@ -1,6 +1,6 @@
import { Box } from '@tlon/indigo-react';
import React, { Suspense, useCallback, useEffect } from 'react';
import { Route, Switch, useHistory } from 'react-router-dom';
import { Route, Switch, useHistory, useLocation } from 'react-router-dom';
import styled from 'styled-components';
import { useLocalStorageState } from '~/logic/lib/useLocalStorageState';
import { PermalinkRoutes } from '~/views/apps/permalinks/app';
@ -11,6 +11,7 @@ import LaunchApp from '~/views/apps/launch/App';
import { getNotificationRedirect } from '~/logic/lib/notificationRedirects';
import { JoinRoute } from './Join/Join';
import useInviteState from '~/logic/state/invite';
import useMetadataState from '~/logic/state/metadata';
export const Container = styled(Box)`
flex-grow: 1;

View File

@ -14,10 +14,8 @@ import { useHistory, useLocation } from 'react-router-dom';
import useGroupState from '~/logic/state/group';
import { useInviteForResource } from '~/logic/state/invite';
import { usePreview } from '~/logic/state/metadata';
import { decline, Invite } from '@urbit/api';
import { join, JoinRequest } from '@urbit/api/groups';
import { joinError, joinLoad, JoinProgress, join, JoinRequest, decline, Invite } from '@urbit/api';
import airlock from '~/logic/api';
import { joinError, joinLoad, JoinProgress } from '@urbit/api';
import { useQuery } from '~/logic/lib/useQuery';
import { JoinDesc, JoinSkeleton } from './Skeleton';

View File

@ -1,27 +1,23 @@
import React, { useEffect, useState } from "react";
import React from 'react';
import {
Col,
Row,
Text,
Box,
Button,
ManagedTextInputField,
ManagedCheckboxField,
ContinuousProgressBar,
} from "@tlon/indigo-react";
import { ModalOverlay } from "~/views/components/ModalOverlay";
import Author from "~/views/components/Author";
import { GroupSummary } from "../GroupSummary";
Box
} from '@tlon/indigo-react';
import { ModalOverlay } from '~/views/components/ModalOverlay';
import Author from '~/views/components/Author';
import { GroupSummary } from '../GroupSummary';
import { resourceFromPath } from "~/logic/lib/group";
import { resourceFromPath } from '@urbit/api';
import useMetadataState, { usePreview } from "~/logic/state/metadata";
import useInviteState, { useInviteForResource } from "~/logic/state/invite";
import {useHistory} from "react-router-dom";
import { usePreview } from '~/logic/state/metadata';
import { useInviteForResource } from '~/logic/state/invite';
import { useHistory } from 'react-router-dom';
const SUMMARY_HEIGHT = "96px";
const SUMMARY_HEIGHT = '96px';
export type JoinKind = "graph" | "groups";
export type JoinKind = 'graph' | 'groups';
export interface JoinDesc {
group: string;
@ -38,7 +34,7 @@ interface JoinSkeletonProps {
}
export function JoinSkeleton(props: JoinSkeletonProps) {
const { title, body, children, onJoin, desc, modal } = props;
const { title, children, desc, modal } = props;
const history = useHistory();
const dismiss = () => {
history.push({ search: '' });
@ -46,24 +42,24 @@ export function JoinSkeleton(props: JoinSkeletonProps) {
const inner = (
<Col
width={modal ? ["90vw", "384px"] : undefined}
borderRadius="2"
backgroundColor="white"
width={modal ? ['90vw', '384px'] : undefined}
borderRadius='2'
backgroundColor='white'
>
<Col
gapY="4"
p="4"
borderRadius="2"
backgroundColor="washedGray"
justifyContent="space-between"
gapY='4'
p='4'
borderRadius='2'
backgroundColor='washedGray'
justifyContent='space-between'
flexGrow={1}
>
<Box maxWidth="512px">
<Text fontWeight="medium" fontSize="2">
<Box maxWidth='512px'>
<Text fontWeight='medium' fontSize='2'>
{title}
</Text>
</Box>
{!!desc ? <JoinBody desc={desc} /> : null}
{desc ? <JoinBody desc={desc} /> : null}
</Col>
{children}
</Col>
@ -78,30 +74,30 @@ export function JoinSkeleton(props: JoinSkeletonProps) {
export function JoinBody(props: { desc: JoinDesc }) {
const { desc } = props;
const { group, kind } = desc || {};
const { preview, error } = usePreview(group);
const { preview } = usePreview(group);
const { ship, name } = resourceFromPath(group);
const invite = useInviteForResource(kind, ship, name);
return (
<>
{!desc ? "Prompt invite link" : null}
{!desc ? 'Prompt invite link' : null}
{preview ? (
<GroupSummary
memberCount={preview.members}
channelCount={preview["channel-count"]}
channelCount={preview['channel-count']}
metadata={preview.metadata}
height={SUMMARY_HEIGHT}
width="100%"
maxWidth="100%"
overflow="hidden"
width='100%'
maxWidth='100%'
overflow='hidden'
/>
) : (
<FallbackSummary path={group} />
)}
{invite ? (
<Col gapY="2">
<Col gapY='2'>
<Box>
<Text>
<Text mono>{invite.ship}</Text> <Text gray>invited you</Text>
@ -109,7 +105,7 @@ export function JoinBody(props: { desc: JoinDesc }) {
</Box>
{invite.text?.length > 0 ? (
<Box>
<Text>"{invite.text}"</Text>
<Text>&quot;{ invite.text }&quot;</Text>
</Box>
) : null}
</Col>
@ -120,18 +116,18 @@ export function JoinBody(props: { desc: JoinDesc }) {
function FallbackSummary(props: { path: string }) {
const { path } = props;
const [, , ship, name] = path.split("/");
const [, , ship, name] = path.split('/');
return (
<Row
height={SUMMARY_HEIGHT}
width="100%"
overflow="hidden"
alignItems="center"
gapX="0"
width='100%'
overflow='hidden'
alignItems='center'
gapX='0'
>
<Author gray fullNotIcon size={40} showImage ship={ship} dontShowTime />
<Text mono whiteSpace="nowrap" overflow="hidden" textOverflow="ellipsis">
<Text mono whiteSpace='nowrap' overflow='hidden' textOverflow='ellipsis'>
/{name}
</Text>
</Row>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff