This repository has been archived by the owner on May 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #205 from tipisai/feat/auth
Feat/auth
- Loading branch information
Showing
12 changed files
with
265 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 118 additions & 0 deletions
118
apps/agent/src/page/SettingPage/account/linked/components/LinkCard/cache.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
// import { App, Button } from "antd" | ||
// import { FC, useState } from "react" | ||
// import { useTranslation } from "react-i18next" | ||
// import { useNavigate } from "react-router-dom" | ||
// import { useCancelLinkedMutation } from "@illa-public/user-data" | ||
// import { useLazyGetOAuthURIQuery } from "@illa-public/user-data" | ||
// import { SETTING_PASSWORD_PATH } from "@/router/constants" | ||
// import { OAUTH_REDIRECT_URL } from "@/utils/oauth" | ||
// import { LinkCardProps } from "./interface" | ||
// import { | ||
// buttonWrapperStyle, | ||
// containerStyle, | ||
// descriptionStyle, | ||
// headerContainerStyle, | ||
// iconContainerStyle, | ||
// titleContainerStyle, | ||
// titleStyle, | ||
// } from "./style" | ||
|
||
// export const LinkCard: FC<LinkCardProps> = (props) => { | ||
// const { icon, title, description, type, handleClick } = props | ||
// const { t } = useTranslation() | ||
// const { message } = App.useApp() | ||
// const [connectedLoading, setConnectedLoading] = useState(false) | ||
// const [triggerGetOAuthURI] = useLazyGetOAuthURIQuery() | ||
// const [cancelLinked] = useCancelLinkedMutation() | ||
|
||
// const tipsNotHasPassword = () => { | ||
// const tipsModal = modal.confirm({ | ||
// title: t("profile.setting.oauth.modal.title"), | ||
// okText: t("profile.setting.oauth.modal.set_button"), | ||
// cancelText: t("profile.setting.oauth.modal.cancel_button"), | ||
// content: t("profile.setting.oauth.modal.description"), | ||
// onOk: () => { | ||
// tipsModal.update({ | ||
// open: false, | ||
// }) | ||
|
||
// navigate(SETTING_PASSWORD_PATH) | ||
// }, | ||
// onCancel: () => { | ||
// tipsModal.update({ | ||
// open: false, | ||
// }) | ||
// }, | ||
// }) | ||
// } | ||
|
||
// const handleDisconnect = async () => { | ||
// if (!hasPassword) { | ||
// tipsNotHasPassword() | ||
// return | ||
// } | ||
// try { | ||
// setConnectedLoading(true) | ||
// await cancelLinked(type) | ||
// message.success({ | ||
// content: t("profile.setting.oauth.message.disconnect_suc"), | ||
// }) | ||
// } catch (e) { | ||
// message.error({ | ||
// content: t("profile.setting.oauth.message.disconnect_failed"), | ||
// }) | ||
// } finally { | ||
// setConnectedLoading(false) | ||
// } | ||
// } | ||
|
||
// const handleConnect = async () => { | ||
// try { | ||
// setConnectedLoading(true) | ||
// const OAuthURIResponse = await triggerGetOAuthURI({ | ||
// oauthAgency: type, | ||
// landing: "connect", | ||
// redirectURI: OAUTH_REDIRECT_URL, | ||
// }).unwrap() | ||
// const { uri } = OAuthURIResponse | ||
// window.open(uri, "_self") | ||
// } catch (e) { | ||
// } finally { | ||
// setConnectedLoading(false) | ||
// } | ||
// } | ||
|
||
// return ( | ||
// <div css={containerStyle}> | ||
// <div css={headerContainerStyle}> | ||
// <div css={titleContainerStyle}> | ||
// <span css={iconContainerStyle}>{icon}</span> | ||
// <span css={titleStyle}>{title}</span> | ||
// </div> | ||
// <span css={descriptionStyle}>{description}</span> | ||
// </div> | ||
// <span css={buttonWrapperStyle}> | ||
// {isConnected ? ( | ||
// <Button | ||
// size="large" | ||
// loading={connectedLoading} | ||
// onClick={handleDisconnect} | ||
// > | ||
// {t("profile.setting.oauth.button.disconnect")} | ||
// </Button> | ||
// ) : ( | ||
// <Button | ||
// type="primary" | ||
// size="large" | ||
// onClick={handleConnect} | ||
// loading={connectedLoading} | ||
// > | ||
// {t("profile.setting.oauth.button.connect")} | ||
// </Button> | ||
// )} | ||
// </span> | ||
// </div> | ||
// ) | ||
// } | ||
|
||
export {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type ILinkProvider = "google" | "github" |
46 changes: 24 additions & 22 deletions
46
apps/agent/src/page/SettingPage/account/linked/mobile/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,27 @@ | ||
import Icon from "@ant-design/icons" | ||
import { FC } from "react" | ||
import { useTranslation } from "react-i18next" | ||
import { GithubIcon } from "@illa-public/icon" | ||
import { useGetUserInfoQuery } from "@illa-public/user-data" | ||
import { LinkCard } from "../components/LinkCard" | ||
// import Icon from "@ant-design/icons" | ||
// import { FC } from "react" | ||
// import { useTranslation } from "react-i18next" | ||
// import { GithubIcon } from "@illa-public/icon" | ||
// import { useGetUserInfoQuery } from "@illa-public/user-data" | ||
// import { LinkCard } from "../components/LinkCard" | ||
|
||
export const MobileLinkedSetting: FC = () => { | ||
const { t } = useTranslation() | ||
// export const MobileLinkedSetting: FC = () => { | ||
// const { t } = useTranslation() | ||
|
||
const { data } = useGetUserInfoQuery(null) | ||
const ssoVerified = data?.ssoVerified | ||
const hasPassword = data?.isPasswordSet | ||
// const { data } = useGetUserInfoQuery(null) | ||
// const ssoVerified = data?.ssoVerified | ||
// const hasPassword = data?.isPasswordSet | ||
|
||
return ( | ||
<LinkCard | ||
title="Github" | ||
description={t("profile.setting.oauth.description.GitHub_unconnect")} | ||
icon={<Icon component={GithubIcon} />} | ||
type="github" | ||
isConnected={ssoVerified?.github ?? false} | ||
hasPassword={hasPassword ?? false} | ||
/> | ||
) | ||
} | ||
// return ( | ||
// <LinkCard | ||
// title="Github" | ||
// description={t("profile.setting.oauth.description.GitHub_unconnect")} | ||
// icon={<Icon component={GithubIcon} />} | ||
// type="github" | ||
// isConnected={ssoVerified?.github ?? false} | ||
// hasPassword={hasPassword ?? false} | ||
// /> | ||
// ) | ||
// } | ||
|
||
export {} |
Oops, something went wrong.