Skip to content

Commit

Permalink
remove(libfgg): add type box
Browse files Browse the repository at this point in the history
  • Loading branch information
a-wing committed Jul 3, 2023
1 parent 534756f commit affe55b
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 37 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion webapp/components2/file-item.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta } from "../lib/archive"
import { Meta } from "../libfgg"
import logo from "/logo192.png"
import { filesize } from "filesize"

Expand Down
2 changes: 1 addition & 1 deletion webapp/components2/recver-file.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import FileItem from "./file-item"
import { Box } from "../lib/box"
import { Box } from "../libfgg/index"
import { ExpiresAtHumanTime } from "../lib/util"
import Qrcode from "./qr-code"
import { getRaw, getServer } from "../lib/api"
Expand Down
2 changes: 1 addition & 1 deletion webapp/components2/recver.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState, useEffect } from "react"
import { Box } from "../lib/box"
import { Box } from "../libfgg/index"
import RecverFile from "./recver-file"
import { getBox, shareGetRoom } from "../lib/api"

Expand Down
5 changes: 2 additions & 3 deletions webapp/components2/send-area.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ import { useRef, useState, ChangeEvent, useEffect } from "react"
import { useAtom } from "jotai"
import { filesize } from "filesize"

import Archive, { Meta } from "../lib/archive"
import Archive from "../lib/archive"
import LibFgg, { Box, Meta } from "../libfgg"
import { getServer, putBox } from "../lib/api"
import { loadHistory } from "../lib/history"
import { Box } from "../lib/box"
import FileItem from "./file-item"
import { ItemsAtom } from "../store"
import SendFile from "./send-file"

import LibFgg from "../libfgg/libfgg"
import { ProtoHttpToWs } from "../lib/util"
import { DomSendFile } from "../libfgg/pool/file/dom"

Expand Down
2 changes: 1 addition & 1 deletion webapp/components2/send-file.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Qrcode from "./qr-code"
import { Box } from "../lib/box"
import { Box } from "../libfgg/index"
import { generateShare } from "../lib/api"

export default (props: { file: Box, callback: (_: Box | null) => void }) => {
Expand Down
2 changes: 1 addition & 1 deletion webapp/lib/api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box } from "./box"
import { Box } from "../libfgg/index"
import { shareGetRoom, generateShare } from "./share"

const ws = '/signal/'
Expand Down
13 changes: 1 addition & 12 deletions webapp/lib/archive.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
import PizZip from "pizzip"
import { Item } from "../lib/box"
import { Item, Meta } from "../libfgg/index"

const ArchiveName = "filegogo-archive.zip"
const ArchiveType = "application/zip"

interface Meta {
name: string
// TODO: mime
type: string
size: number
}

export type {
Meta
}

export default class Archive {
//private
files: File[]
Expand Down
2 changes: 1 addition & 1 deletion webapp/lib/history.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box } from "./box"
import { Box } from "../libfgg"
import { getBox } from "./api"

type warpResult = Promise<{ uxid: string, data: Box }>
Expand Down
2 changes: 1 addition & 1 deletion webapp/lib/box.ts → webapp/libfgg/box.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta } from "../lib/archive"
import { Meta } from "./pool/data"

interface Item {
name: string
Expand Down
11 changes: 11 additions & 0 deletions webapp/libfgg/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import LibFgg from "./libfgg"
import { Box, Item } from "./box"
import { Meta } from "./pool/data"

export default LibFgg

export type {
Box,
Item,
Meta,
}
21 changes: 7 additions & 14 deletions webapp/main.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './app2'
import React from "react"
import ReactDOM from "react-dom/client"
import App from "./app"

import { Provider } from "jotai"

import 'virtual:uno.css'
//import '@unocss/reset/normalize.css'
import '@unocss/reset/tailwind.css'
//import '@unocss/reset/tailwind-compat.css'
//import 'virtual:windi.css'
//import 'virtual:windi-devtools'
//import 'virtual:windi-base.css'
//import 'virtual:windi-components.css'
//import 'virtual:windi-utilities.css'
import "virtual:uno.css"
import "@unocss/reset/tailwind.css"

import GithubCorner from 'react-github-corner'
import GithubCorner from "react-github-corner"

ReactDOM.createRoot(document.getElementById('root')!).render(
ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<Provider>
<App/>
Expand Down
2 changes: 1 addition & 1 deletion webapp/store.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { atom } from "jotai"
import { Box } from "./lib/box"
import { Box } from "./libfgg"

const ItemsAtom = atom<Array<Box>>([])

Expand Down

0 comments on commit affe55b

Please sign in to comment.