Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
tamas6 authored Jan 25, 2024
2 parents 8eda635 + c3732aa commit 4e636af
Show file tree
Hide file tree
Showing 31 changed files with 229 additions and 143 deletions.
61 changes: 38 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@emotion/react": "^11.4.1",
"@emotion/styled": "^11.3.0",
"@fairdatasociety/blossom": "^0.5.0",
"@fairdatasociety/fdp-storage": "^0.13.0",
"@fairdatasociety/fdp-storage": "^0.17.0",
"@headlessui/react": "^1.7.14",
"@metamask/sdk": "^0.5.6",
"@types/react-blockies": "^1.4.1",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Connect/Metamask/MetamaskConnect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const MetamaskConnect = ({ onConnect }: MetamaskConnectProps) => {
setAddress(wallet.address);
setMnemonic(mnemonic);

router.push('/overview');
router.push('/drive');
} catch (error) {
console.error(error);
setErrorMessage(String(error.message || error));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export default function MetamaskCreateAccount({

await fdpClientRef.current.account.register(request);
setWallet(fdpClientRef.current.account.wallet);
setFdpStorageType('native');
setFdpStorageType('native', undefined, false);
setIsLoggedIn(true);
setLoginType('username');
setUser(username);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ const MetamaskMigrationDialog = ({
if (clickOutside) {
return;
}
setMetamaskMigrationNotification('closed');
setMetamaskMigrationNotification(
step === Step.COMPLETE ? 'completed' : 'closed'
);
onClose();
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/Footers/MainFooter/MainFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const MainFooter: FC = () => {
const { intl } = useLocales();

return (
<div className="hidden md:flex justify-between items-center w-full h-32 px-8 bg-white shadow-top">
<div className="hidden md:flex justify-between items-center w-full py-2 px-8 bg-white shadow-top">
<div className="flex items-center flex-wrap mr-4">
<a
href="https://fairdatasociety.org/"
Expand Down
159 changes: 86 additions & 73 deletions src/components/Forms/LoginForm/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { setDefaultNetwork } from '@utils/localStorage';
import { useLocales } from '@context/LocalesContext';
import CustomCheckbox from '@components/Inputs/CustomCheckbox/CustomCheckbox';
import { useMatomoContext } from '@context/Matomo';
import MetamaskConnect from '@components/Connect/Metamask/MetamaskConnect';

const ALLOW_TRACKING_KEY = 'allow-matomo';

Expand Down Expand Up @@ -51,6 +52,7 @@ const LoginForm: FC = () => {
} = useFdpStorage();
const router = useRouter();
const { intl } = useLocales();
const fdsLoginEnabled = router?.query['fdsLogin'] === 'true';

const onSubmit = async (data: { user_name: string; password: string }) => {
try {
Expand All @@ -68,7 +70,7 @@ const LoginForm: FC = () => {
setLoginType('username');
setUser(user_name);
setDefaultNetwork(String(network.id));
router.push('/overview');
router.push('/drive');
} catch (error) {
setErrorMessage(error.message);
} finally {
Expand Down Expand Up @@ -116,10 +118,12 @@ const LoginForm: FC = () => {

return (
<div className="flex flex-col px-3 justify-center items-center">
<DisclaimerMessage
icon={IconType.WARNING}
text={disclaimerMessages.join(' ')}
/>
<div className="max-w-xl">
<DisclaimerMessage
icon={IconType.WARNING}
text={disclaimerMessages.join(' ')}
/>
</div>

<AuthenticationHeader
title={intl.get('WELCOME_BACK')}
Expand All @@ -131,78 +135,87 @@ const LoginForm: FC = () => {
<FeedbackMessage type="error" message={errorMessage} />
</div>

<form onSubmit={handleSubmit(onSubmit)} className="w-full">
<label className="font-normal text-base text-color-accents-plum-black dark:text-color-accents-grey-pastel">
{intl.get('CHOOSE_NETWORK')}:
</label>
<NetworkDropdown
className="mb-3"
value={network}
onChange={onNetworkChange}
/>

<AuthenticationInput
label={intl.get('USERNAME')}
id="user_name"
type="text"
name="user_name"
placeholder={intl.get('TYPE_HERE')}
useFormRegister={register}
validationRules={{
required: intl.get('USERNAME_IS_REQUIRED'),
minLength: {
value: 4,
message: intl.get('USERNAME_MIN_LENGTH_ERROR'),
},
}}
// @ts-ignore
error={errors.user_name}
/>

<AuthenticationInput
label={intl.get('PASSWORD')}
id="password"
type="password"
name="password"
placeholder={intl.get('TYPE_HERE')}
useFormRegister={register}
validationRules={{
required: intl.get('PASSWORD_IS_REQUIRED'),
}}
// @ts-ignore
error={errors.password}
/>

<CustomCheckbox
className="mb-3 sm:mb-0"
name="confirm"
onChange={onAllowTrackingClick}
checked={allowTracking}
>
{intl.get('ALLOW_TRACKING')}
</CustomCheckbox>

<div className="mt-8 text-center">
<Button
loading={loading}
disabled={!isValid}
type="submit"
variant="secondary"
label={intl.get('LOGIN')}
{fdsLoginEnabled ? (
<form onSubmit={handleSubmit(onSubmit)} className="w-full">
<label className="font-normal text-base text-color-accents-plum-black dark:text-color-accents-grey-pastel">
{intl.get('CHOOSE_NETWORK')}:
</label>
<NetworkDropdown
className="mb-3"
value={network}
onChange={onNetworkChange}
/>

<AuthenticationInput
label={intl.get('USERNAME')}
id="user_name"
type="text"
name="user_name"
placeholder={intl.get('TYPE_HERE')}
useFormRegister={register}
validationRules={{
required: intl.get('USERNAME_IS_REQUIRED'),
minLength: {
value: 4,
message: intl.get('USERNAME_MIN_LENGTH_ERROR'),
},
}}
// @ts-ignore
error={errors.user_name}
/>

<AuthenticationInput
label={intl.get('PASSWORD')}
id="password"
type="password"
name="password"
placeholder={intl.get('TYPE_HERE')}
useFormRegister={register}
validationRules={{
required: intl.get('PASSWORD_IS_REQUIRED'),
}}
// @ts-ignore
error={errors.password}
/>
</div>

<div className="my-6 text-center">
<a
href={CREATE_USER_URL}
target={'_blank'}
rel="noopener noreferrer"
className="font-normal text-xs text-color-accents-purple-black dark:text-color-accents-grey-lavendar"
<CustomCheckbox
className="mb-3 sm:mb-0"
name="confirm"
onChange={onAllowTrackingClick}
checked={allowTracking}
>
{intl.get('REGISTER_NEW_ACCOUNT')}
</a>
{intl.get('ALLOW_TRACKING')}
</CustomCheckbox>

<div className="mt-8 text-center">
<Button
loading={loading}
disabled={!isValid}
type="submit"
variant="secondary"
label={intl.get('LOGIN')}
/>
</div>

<div className="my-6 text-center">
<a
href={CREATE_USER_URL}
target={'_blank'}
rel="noopener noreferrer"
className="font-normal text-xs text-color-accents-purple-black dark:text-color-accents-grey-lavendar"
>
{intl.get('REGISTER_NEW_ACCOUNT')}
</a>
</div>
</form>
) : (
<div className="w-full flex">
<span className="m-auto">
{/* eslint-disable-next-line @typescript-eslint/no-empty-function */}
<MetamaskConnect onConnect={() => {}} onError={() => {}} />
</span>
</div>
</form>
)}
</div>
</div>
);
Expand Down
5 changes: 3 additions & 2 deletions src/components/Layouts/MainLayout/MainLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ const MainLayout: FC<MainLayoutProps> = ({
</div>

<div className="flex flex-col sm:flex-row justify-items-stretch items-stretch w-full h-full overflow-hidden">
<div className="sm:w-28 dark:bg-color-shade-dark-3-night">
{/* sm:w-28 */}
<div className="dark:bg-color-shade-dark-3-night">
<MainSideBar
driveSideBarToggle={driveSideBarToggle}
updateDrive={updateDrive}
Expand Down Expand Up @@ -87,7 +88,7 @@ const MainLayout: FC<MainLayoutProps> = ({
</div>
</div>

<div className="hidden md:block w-full h-36 dark:bg-color-shade-dark-3-night">
<div className="hidden md:block w-full dark:bg-color-shade-dark-3-night">
<MainFooter />
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Modals/UploadFileModal/UploadFileModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ const UploadFileModal: FC<CreatorModalProps> = ({
podName: activePod,
},
(event: UploadProgressInfo) => {
const { uploadPercentage } = event.data || {};
const { percentage } = event.data || {};

if (uploadPercentage) {
if (percentage) {
setUploadPercentage(
calculateUploadPercentage(
uploadedItemsRef.current.length + failedUplods.length,
Expand Down
Loading

0 comments on commit 4e636af

Please sign in to comment.