Skip to content

Commit

Permalink
fix(web): fix sign up navigate & storage display (#1580)
Browse files Browse the repository at this point in the history
* fix(web): fix storage display

* fix
  • Loading branch information
newfish-cmyk committed Oct 12, 2023
1 parent f7b8775 commit 7dac760
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 54 deletions.
14 changes: 14 additions & 0 deletions web/src/components/FileTypeIcon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const FileType = {
rar: "rar",
tar: "tar",
folder: "folder",
folderOpen: "folderOpen",
npm: "npm",
db: "db",
bucket: "bucket",
Expand Down Expand Up @@ -141,6 +142,19 @@ export default function FileTypeIcon(props: {
/>
</Icon>
);
case FileType.folderOpen:
return (
<Icon width="4" height="4" viewBox="0 0 25 24">
<path
d="M20 8.25V9H6.4025C5.89631 9.00372 5.40465 9.16962 4.99969 9.47334C4.59473 9.77706 4.2978 10.2026 4.1525 10.6875L2.75 15.375V6C2.75178 5.40381 2.98941 4.83255 3.41098 4.41098C3.83255 3.98941 4.40381 3.75178 5 3.75H10.235C10.3576 3.75134 10.478 3.78199 10.5863 3.8394C10.6946 3.89681 10.7876 3.97931 10.8575 4.08L12.1475 6H17.75C18.3462 6.00178 18.9175 6.2394 19.339 6.66098C19.7606 7.08255 19.9982 7.65381 20 8.25Z"
fill="#47C8BF"
/>
<path
d="M22.1525 13.3126L20.5625 18.6451C20.4245 19.1102 20.1393 19.518 19.7499 19.8074C19.3605 20.0968 18.8877 20.2521 18.4025 20.2501H6.2675C5.91651 20.2508 5.57021 20.1693 5.25631 20.0123C4.94241 19.8552 4.66961 19.6269 4.45971 19.3456C4.24981 19.0643 4.10864 18.7377 4.04749 18.3921C3.98633 18.0465 4.00688 17.6913 4.1075 17.3551L4.25 16.8751L5.6525 12.1876C5.7978 11.7027 6.09473 11.2771 6.49969 10.9734C6.90465 10.6697 7.39632 10.5038 7.9025 10.5001H20.09C20.4263 10.4975 20.7584 10.5743 21.0594 10.7242C21.3604 10.874 21.6218 11.0927 21.8225 11.3626C22.0263 11.6391 22.1623 11.9596 22.2196 12.2983C22.2769 12.637 22.254 12.9844 22.1525 13.3126Z"
fill="#47C8BF"
/>
</Icon>
);
case FileType.png:
case FileType.jpg:
case FileType.jpeg:
Expand Down
4 changes: 3 additions & 1 deletion web/src/pages/app/functions/mods/FunctionPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,9 @@ export default function FunctionList() {

return sortedItems.map((item, index) => {
let fileType = FileType.ts;
if (item.children?.length) {
if (item.isExpanded) {
fileType = FileType.folderOpen;
} else if (item.children?.length) {
fileType = FileType.folder;
}
const nameParts = item.name.split("/");
Expand Down
3 changes: 1 addition & 2 deletions web/src/pages/app/storages/mods/CreateWebsiteModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ function CreateWebsiteModal() {
className="mr-2 cursor-pointer"
href={
currentStorage?.websiteHosting?.isCustom
? // custom domain don't support https currently
"http://" + currentStorage?.websiteHosting?.domain
? `${window.location.protocol}//${currentStorage?.websiteHosting?.domain}`
: getOrigin(currentStorage?.websiteHosting?.domain)
}
isExternal
Expand Down
3 changes: 1 addition & 2 deletions web/src/pages/app/storages/mods/FileList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export default function FileList() {
useStorageStore();
const [pageSize, setPageSize] = useState(20);
const bucketName = currentStorage?.name;
console.log(currentStorage);
const bucketType = currentStorage?.policy;

const { colorMode } = useColorMode();
Expand Down Expand Up @@ -216,7 +215,7 @@ export default function FileList() {
</Thead>
<Tbody className="text-grayModern-500">
{queryData.data
.filter((file: any) => file.Key !== prefix)
.filter((file: any) => `/${file.Key}` !== prefix && file.Key !== prefix)
.map((file: TFile) => {
const fileName = file.Key?.split("/");
const dirName = file.Prefix?.split("/") || [];
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/auth/signin/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function SignIn() {
)}
>
{isBindGithub ? (
<div className="mb-10 text-2xl font-semibold text-grayModern-700">
<div className="mb-10 text-[22px] font-semibold text-grayModern-700">
{t("AuthPanel.BindGitHub")}
</div>
) : (
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/auth/signup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export default function SignUp() {

const res = await signupMutation.mutateAsync(params);

if (!res?.data) {
if (res?.data) {
sessionStorage.removeItem("githubToken");
if (githubToken) {
githubAuthControllerBindMutation.mutateAsync({
Expand Down
103 changes: 56 additions & 47 deletions web/src/pages/home/mods/CreateAppModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ const CreateAppModal = (props: {
<ModalHeader>{title}</ModalHeader>
<ModalCloseButton />
<ModalBody>
<VStack spacing={0} align="flex-start">
<VStack spacing={0} align="flex-start" px="8">
<FormControl
isRequired
isInvalid={!!errors?.name}
Expand Down Expand Up @@ -297,52 +297,61 @@ const CreateAppModal = (props: {
</VStack>
</ModalBody>
<ModalFooter h={20}>
<HStack spacing={0}>
<span className="mr-2 flex text-center text-lg font-semibold text-grayModern-600">
<p>{t("Balance") + ":"}</p>
<p className="ml-1">{formatPrice(accountRes?.data?.balance)}</p>
</span>
<ChargeButton>
<p className="!mr-2 cursor-pointer text-lg font-semibold text-blue-600">
{t("ChargeNow")}
</p>
</ChargeButton>
{type !== "edit" && (
<div className="!mx-6 flex items-center">
{!calculating ? (
<span className="mr-2 w-36 text-center text-xl font-semibold text-error-500">
{formatOriginalPrice(totalPrice, 6)} / hour
</span>
) : (
<span className="mr-2 flex w-36 justify-center">
<Spinner className="!h-4 !w-4" />
</span>
)}
</div>
)}
{type !== "edit" && (
<Button
isLoading={createAppMutation.isLoading}
type="submit"
onClick={handleSubmit(onSubmit)}
isDisabled={totalPrice > accountRes?.data?.balance!}
>
{totalPrice > accountRes?.data?.balance!
? t("balance is insufficient")
: type === "change"
? t("Confirm")
: t("CreateNow")}
</Button>
)}
{type === "edit" && (
<Button
isLoading={updateAppMutation.isLoading}
type="submit"
onClick={handleSubmit(onSubmit)}
>
{t("Confirm")}
</Button>
)}
<HStack spacing={0} w="full" justify="space-between" px="8">
<HStack>
<span className="mr-2 flex text-center text-lg font-semibold text-grayModern-600">
<p>{t("Balance") + ":"}</p>
<p className="ml-1">{formatPrice(accountRes?.data?.balance)}</p>
</span>
<ChargeButton>
<p className="!mr-2 cursor-pointer text-lg font-semibold text-blue-600">
{t("ChargeNow")}
</p>
</ChargeButton>
</HStack>
<HStack>
{type !== "edit" && (
<div className="!mx-2 flex items-center">
{!calculating ? (
<span>
<span className="w-36 text-center text-xl font-semibold text-error-500">
{`${formatOriginalPrice(totalPrice, 6)} / ${t("Hour")}`}
</span>
<span className="mx-1 text-[13px] font-medium text-grayModern-600">
{`( ${formatOriginalPrice(totalPrice * 24 * 30)} / ${t("Month")} )`}
</span>
</span>
) : (
<span className="mr-2 flex w-36 justify-center">
<Spinner className="!h-4 !w-4" />
</span>
)}
</div>
)}
{type !== "edit" && (
<Button
isLoading={createAppMutation.isLoading}
type="submit"
onClick={handleSubmit(onSubmit)}
isDisabled={totalPrice > accountRes?.data?.balance!}
>
{totalPrice > accountRes?.data?.balance!
? t("balance is insufficient")
: type === "change"
? t("Confirm")
: t("CreateNow")}
</Button>
)}
{type === "edit" && (
<Button
isLoading={updateAppMutation.isLoading}
type="submit"
onClick={handleSubmit(onSubmit)}
>
{t("Confirm")}
</Button>
)}
</HStack>
</HStack>
</ModalFooter>
</ModalContent>
Expand Down

0 comments on commit 7dac760

Please sign in to comment.