Skip to content

Commit

Permalink
fix: bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
lulu-tro committed Sep 6, 2024
1 parent a728a98 commit 6b3f0d4
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/assets/styles/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@
.min-h-400 {
min-height: 400px;
}
.max-w-515px {
max-width: 515px;
.max-w-450px {
max-width: 450px;
}
.min-w-334px{
min-width: 334px;
Expand Down
4 changes: 2 additions & 2 deletions src/components/Login/Endpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const Endpoint = ({ color }) => {
}, []);

return (
<div className="flex flex-col max-w-515px justify-center ">
<div className="flex flex-col max-w-450px justify-center login-form-w ">
<div className=" min-h-400">
<div className="login-title theme-text-main">{t('login')}</div>
<div className="text-gray-900 text-sm font-bold mb-12 theme-text-sub-main">
Expand All @@ -71,7 +71,7 @@ const Endpoint = ({ color }) => {
</div>
<input
type="text"
className="mr-2 common-input theme-bg theme-border-color theme-text-main"
className="mr-2 common-input theme-bg theme-border-color theme-text-main login-form-w-334px"
defaultValue="http://localhost:5001"
ref={inputRef}
// onChange={handleChange}
Expand Down
3 changes: 2 additions & 1 deletion src/components/Login/PasswordLogin.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,15 @@ const PasswordLogin = ({ color, endpoint }) => {
}, [isLock]);

return (
<div className="flex flex-col justify-center max-w-515px min-w-334px login-form-w ">
<div className="flex flex-col justify-center max-w-450px min-w-334px login-form-w ">
<div className="min-h-400">
<div className="login-title mb-12 theme-text-main"><span onClick={backPrevious} className='cursor-pointer pr-2'><ArrowLeftOutlined style={{ fontSize: 20 }} className='align-middle' /></span>{t('login_title')}</div>
<Form
name="basic"
layout="vertical"
form={form}
requiredMark={false}
className="login-form-w-334px"
// labelCol={{ span: 24 }}
initialValues={{ endpoint }}
onFinish={onFinish}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Login/SetPassword.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const Endpoint = ({ endpoint, isReset }) => {
}

return (
<div className="flex flex-col justify-center max-w-515px login-form-w">
<div className="flex flex-col justify-center max-w-450px login-form-w">
<div className=" min-h-400">
<div className="login-title theme-text-main"><span onClick={backPrevious} className='cursor-pointer pr-2'><ArrowLeftOutlined style={{ fontSize: 20 }} className='align-middle' /></span>{t('set_login_password')}</div>
<div className="text-gray-900 text-sm font-bold mb-12">{t('set_login_password_desc')}</div>
Expand Down
1 change: 1 addition & 0 deletions src/components/Modals/EncryptFileModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export default function EncryptFileModal({ color }) {
let passwords = encryptType === 'host' ? '' : password;
let result = await encryptUploadFiles(currentFile, hostid, passwords, onUploadProgress(fileName));
Emitter.emit('openEncryptFileCidModal', result);
Emitter.emit('updateFiles');
} catch (e) {
Emitter.emit('showMessageAlert', { message: e.Message, status: 'error' });
}
Expand Down
9 changes: 7 additions & 2 deletions src/services/filesService.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const FileType = require('file-type');

let apiUrl = localStorage.getItem('NODE_URL') ? localStorage.getItem('NODE_URL') : "http://localhost:5001";

const token = Cookies.get(apiUrl) || '';
let client;

export const setClient = (apiUrl) => {
Expand Down Expand Up @@ -125,12 +124,13 @@ export const getFolerSize = async (files) => {
export const uploadFiles = async (input, path, onUploadProgress, setErr, setMessage) => {
try {
let url = pathArray2String(path);
const token = Cookies.get(apiUrl) || '';
let totalSize = 0;
if (input.length === 1) {
totalSize = input[0].size;
let file = await client.add(input[0], {
pin: true,
token:token,
token,
progress: (size) => {
onUploadProgress(size, totalSize)
}
Expand Down Expand Up @@ -215,6 +215,7 @@ export const downloadFolder = async (hash, name, size, onDownloadProgress, setEr
export const viewFile = async (hash, name, size) => {
try {
let content = [];
const token = Cookies.get(apiUrl) || '';
for await (const result of client.cat(hash ,{token})) {
content = [...content, ...result];
}
Expand Down Expand Up @@ -248,6 +249,8 @@ export const importFromBTFS = async (hash, path) => {

export const createNewFolder = async (name, path) => {
try {

const token = Cookies.get(apiUrl) || '';
let url = pathArray2String(path);
await client.files.mkdir(url + name, {
parents: true,
Expand All @@ -263,6 +266,8 @@ export const createNewFolder = async (name, path) => {

export const removeFiles = async (hash, name, path, type) => {
try {

const token = Cookies.get(apiUrl) || '';
let url = pathArray2String(path);
if (type === 1) {
await client.files.rm(url + name, {recursive: true,token});
Expand Down

0 comments on commit 6b3f0d4

Please sign in to comment.