Skip to content

Commit

Permalink
Merge branch 'develop' into wip/radeusgd/value-types-1
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] committed Mar 31, 2023
2 parents ec3aada + 0aa7d7e commit c697831
Show file tree
Hide file tree
Showing 22 changed files with 1,489 additions and 1,560 deletions.
5 changes: 3 additions & 2 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
overrides:
- files:
- "*.[j|t]s"
- "*.mjs"
- "*.cjs"
- "*.[j|t]sx"
- "*.m[j|t]s"
- "*.c[j|t]s"
options:
printWidth: 100
tabWidth: 4
Expand Down
11 changes: 10 additions & 1 deletion app/ide-desktop/lib/content/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,18 @@ class Main {
* and one for the desktop. Once these are merged, we can't hardcode the
* platform here, and need to detect it from the environment. */
const platform = authentication.Platform.desktop
/** FIXME [PB]: https://github.com/enso-org/cloud-v2/issues/366
* React hooks rerender themselves multiple times. It is resulting in multiple
* Enso main scene being initialized. As a temporary workaround we check whether
* appInstance was already ran. Target solution should move running appInstance
* where it will be called only once. */
let appInstanceRan = false
const onAuthenticated = () => {
hideAuth()
void appInstance.run()
if (!appInstanceRan) {
appInstanceRan = true
void appInstance.run()
}
}
authentication.run(logger, platform, onAuthenticated)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,67 +3,67 @@
* For example, this file contains the {@link SvgIcon} component, which is used by the
* `Registration` and `Login` components. */

import * as fontawesome from "@fortawesome/react-fontawesome";
import * as fontawesomeIcons from "@fortawesome/free-brands-svg-icons";
import * as fontawesome from '@fortawesome/react-fontawesome'
import * as fontawesomeIcons from '@fortawesome/free-brands-svg-icons'

import * as icons from "../../components/svg";
import * as icons from '../../components/svg'

// =============
// === Input ===
// =============

export function Input(props: React.InputHTMLAttributes<HTMLInputElement>) {
return (
<input
{...props}
className={
"text-sm sm:text-base placeholder-gray-500 pl-10 pr-4 rounded-lg border border-gray-400 " +
"w-full py-2 focus:outline-none focus:border-blue-400"
}
/>
);
return (
<input
{...props}
className={
'text-sm sm:text-base placeholder-gray-500 pl-10 pr-4 rounded-lg border border-gray-400 ' +
'w-full py-2 focus:outline-none focus:border-blue-400'
}
/>
)
}

// ===============
// === SvgIcon ===
// ===============

interface SvgIconProps {
data: string;
data: string
}

export function SvgIcon(props: SvgIconProps) {
return (
<div
className={
"inline-flex items-center justify-center absolute left-0 top-0 h-full w-10 " +
"text-gray-400"
}
>
<span>
<icons.Svg {...props} />
</span>
</div>
);
return (
<div
className={
'inline-flex items-center justify-center absolute left-0 top-0 h-full w-10 ' +
'text-gray-400'
}
>
<span>
<icons.Svg {...props} />
</span>
</div>
)
}

// =======================
// === FontAwesomeIcon ===
// =======================

interface FontAwesomeIconProps {
icon: fontawesomeIcons.IconDefinition;
icon: fontawesomeIcons.IconDefinition
}

export function FontAwesomeIcon(props: FontAwesomeIconProps) {
return (
<span
className={
"absolute left-0 top-0 flex items-center justify-center h-full w-10 " +
"text-blue-500"
}
>
<fontawesome.FontAwesomeIcon icon={props.icon} />
</span>
);
return (
<span
className={
'absolute left-0 top-0 flex items-center justify-center h-full w-10 ' +
'text-blue-500'
}
>
<fontawesome.FontAwesomeIcon icon={props.icon} />
</span>
)
}
Original file line number Diff line number Diff line change
@@ -1,62 +1,60 @@
/** @file Registration confirmation page for when a user clicks the confirmation link set to their
* email address. */
import * as react from "react";
import * as router from "react-router-dom";
import toast from "react-hot-toast";
import * as react from 'react'
import * as router from 'react-router-dom'
import toast from 'react-hot-toast'

import * as app from "../../components/app";
import * as auth from "../providers/auth";
import * as loggerProvider from "../../providers/logger";
import * as app from '../../components/app'
import * as auth from '../providers/auth'
import * as loggerProvider from '../../providers/logger'

// =================
// === Constants ===
// =================

const REGISTRATION_QUERY_PARAMS = {
verificationCode: "verification_code",
email: "email",
} as const;
verificationCode: 'verification_code',
email: 'email',
} as const

// ============================
// === Confirm Registration ===
// ============================

function ConfirmRegistration() {
const logger = loggerProvider.useLogger();
const { confirmSignUp } = auth.useAuth();
const { search } = router.useLocation();
const navigate = router.useNavigate();

const { verificationCode, email } = parseUrlSearchParams(search);

react.useEffect(() => {
if (!email || !verificationCode) {
navigate(app.LOGIN_PATH);
} else {
confirmSignUp(email, verificationCode)
.then(() => {
navigate(app.LOGIN_PATH + search.toString());
})
.catch((error) => {
logger.error("Error while confirming sign-up", error);
toast.error(
"Something went wrong! Please try again or contact the administrators."
);
navigate(app.LOGIN_PATH);
});
}
}, []);

return <></>;
const logger = loggerProvider.useLogger()
const { confirmSignUp } = auth.useAuth()
const { search } = router.useLocation()
const navigate = router.useNavigate()

const { verificationCode, email } = parseUrlSearchParams(search)

react.useEffect(() => {
if (!email || !verificationCode) {
navigate(app.LOGIN_PATH)
} else {
confirmSignUp(email, verificationCode)
.then(() => {
navigate(app.LOGIN_PATH + search.toString())
})
.catch(error => {
logger.error('Error while confirming sign-up', error)
toast.error(
'Something went wrong! Please try again or contact the administrators.'
)
navigate(app.LOGIN_PATH)
})
}
}, [])

return <></>
}

function parseUrlSearchParams(search: string) {
const query = new URLSearchParams(search);
const verificationCode = query.get(
REGISTRATION_QUERY_PARAMS.verificationCode
);
const email = query.get(REGISTRATION_QUERY_PARAMS.email);
return { verificationCode, email };
const query = new URLSearchParams(search)
const verificationCode = query.get(REGISTRATION_QUERY_PARAMS.verificationCode)
const email = query.get(REGISTRATION_QUERY_PARAMS.email)
return { verificationCode, email }
}

export default ConfirmRegistration;
export default ConfirmRegistration
Loading

0 comments on commit c697831

Please sign in to comment.