import { GoogleDrive, Mega, iCloud } from '@sd/assets/images'; import clsx from 'clsx'; import { Icon, User } from 'phosphor-react'; import { tw } from '@sd/ui'; import { SubtleButton, SubtleButtonContainer } from '~/components'; import { OperatingSystem } from '~/util/Platform'; import classes from './spacedrop.module.scss'; // const { Form, Input, useZodForm, z } = forms; // TODO: move this to UI, copied from Inspector const Pill = tw.span`mt-1 inline border border-transparent px-0.5 text-[9px] font-medium shadow shadow-app-shade/5 bg-app-selected rounded text-ink-dull`; type DropItemProps = { // TODO: remove optionals when dummy data is removed (except for icon) name?: string; connectionType?: 'lan' | 'bluetooth' | 'usb' | 'p2p' | 'cloud'; receivingNodeOsType?: Omit; } & ({ image: string } | { icon?: Icon } | { brandIcon: string }); function DropItem(props: DropItemProps) { let icon; if ('image' in props) { icon = {props.name}; } else if ('brandIcon' in props) { let brandIconSrc; switch (props.brandIcon) { case 'google-drive': brandIconSrc = GoogleDrive; break; case 'icloud': brandIconSrc = iCloud; break; case 'mega': brandIconSrc = Mega; break; } if (brandIconSrc) { icon = (
{props.name}
); } } else { // const Icon = props.icon || User; icon = ; } return (
{/* */}
{icon}
{props.name && {props.name}}
{props.receivingNodeOsType && {props.receivingNodeOsType}} {props.connectionType && ( {props.connectionType} )}
); } // const schema = z.object({ // target_peer: z.string(), // file_path: z.string() // }); // // TODO: This will be removed and properly hooked up to the UI in the future // function TemporarySpacedropDemo() { // const [[discoveredPeers], setDiscoveredPeer] = useState([new Map()]); // const doSpacedrop = useBridgeMutation('p2p.spacedrop'); // const form = useZodForm({ // schema // }); // useBridgeSubscription(['p2p.events'], { // onData(data) { // if (data.type === 'DiscoveredPeer') { // setDiscoveredPeer([discoveredPeers.set(data.peer_id, data.metadata)]); // // if (!form.getValues().target_peer) form.setValue('target_peer', data.peer_id); // } // } // }); // const onSubmit = form.handleSubmit((data) => { // doSpacedrop.mutate({ // peer_id: data.target_peer, // file_path: data.file_path // }); // }); // // TODO: Input select // return ( //
// Spacedrop Demo //

// Note: Right now the file must be less than 255 bytes long and only contain UTF-8 // chars. Create a txt file in Vscode to test (note macOS TextEdit cause that is rtf by // default) //

//
// // // // //
//
// ); // } export const Component = () => { return ( <> {/* */}
); };