Skip to content

Conversation

@Ryz0nd
Copy link
Contributor

@Ryz0nd Ryz0nd commented Jan 5, 2026

Pull Request

Thank you for raising a Pull Request. Please follow the instruction.

  • I’ve read CONTRIBUTING.md and followed the guidelines.

Summary

oko_sdk_core: add login modal for OAuth provider selection
스크린샷 2026-01-05 오후 10 14 44

Links (Issue References, etc, if there's any)

} from "@oko-wallet-sdk-core/ui/login_modal";

// Prevent multiple modals from being opened simultaneously
let activeModalController: LoginModalController | null = null;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm against the naming. It gives me the impression that this is a class instance.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, could you "const"-ify this variable then have the code mutate the property?

e.g., some_state = { mutable: null }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!

@chemonoworld
Copy link
Contributor

I merged main into this PR for CI type-check. If you don't want it, you can revert that.

// Not signed in - trigger OAuth sign in
await okoSolWallet.okoWallet.signIn("google");
// Not signed in - open provider select modal
await okoSolWallet.okoWallet.login();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

openLogInModal() 같은 느낌의 이름으로 해야할듯 합니다

Copy link
Contributor Author

@Ryz0nd Ryz0nd Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed it to openSignInModal() since it essentially wraps the existing signIn method

@Ryz0nd Ryz0nd marked this pull request as draft January 7, 2026 01:34
export function renderLoginModal(
options: LoginModalOptions,
): LoginModalController {
const { onSelect, onClose, theme = "system" } = options;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't you use React? This will very rapidly become hard to maintain

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think React might not be the best fit since this is a framework-agnostic SDK that needs to work in any app (React, Vue, Angular, vanilla JS). Adding React could force dependencies on consumers, cause version conflicts, and increase bundle size for a simple modal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do agree maintainability is important, so I refactored to use HTML templates. What do you think of this approach?

@@ -0,0 +1,364 @@
export const MODAL_STYLES = `
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you decide to use some ui drawing lib like React, the style definition will also need to be adjusted. (in a safer way)

@Ryz0nd Ryz0nd marked this pull request as ready for review January 12, 2026 01:12

contentWrapper.addEventListener("click", (e) => {
const btn = (e.target as HTMLElement).closest("button") as HTMLButtonElement | null;
if (!btn || btn.disabled) return;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curly bracket

const resolvedTheme = resolveTheme(theme);

const container = document.createElement("div");
container.id = "oko-signin-modal";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please const-ify this string

return getHostTheme() ?? getSystemTheme();
}

function defaultViewTemplate(theme: ResolvedTheme): string {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ryz0nd Why didn't you try using React?

"@oko-wallet/oko-types": "^0.0.1-alpha.5",
"@oko-wallet/stdlib-js": "^0.0.2-rc.45"
"@oko-wallet/stdlib-js": "^0.0.2-rc.45",
"preact": "^10.25.4"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@eldenpark eldenpark changed the base branch from main to develop January 13, 2026 03:12
@eldenpark eldenpark merged commit ec7643a into develop Jan 13, 2026
5 checks passed
@Ryz0nd Ryz0nd deleted the OKO-522 branch January 13, 2026 03:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants