-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
168 additions
and
17 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
59 changes: 59 additions & 0 deletions
59
bootstrap/manager/src/ui/src/components/modals/TextInputModal.jsx
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,59 @@ | ||
import { useEffect, useState } from 'react' | ||
|
||
import Modal from './Modal' | ||
|
||
function TextInputModal ({ title, message, confirmText = 'Submit', rows = 4, cols = 40, open = false, onClose }) { | ||
const [textData, setTextData] = useState('') | ||
|
||
useEffect(() => { | ||
if (open) { | ||
setTextData('') | ||
} | ||
}, [open]) | ||
|
||
const handleSubmit = (success) => { | ||
if (!success) return onClose(success) | ||
|
||
onClose(true, textData) | ||
} | ||
|
||
return ( | ||
<Modal | ||
title={title} | ||
confirmText={confirmText} | ||
color='green' | ||
open={open} | ||
onClose={handleSubmit} | ||
content={ | ||
<> | ||
{message && | ||
<p className='text-sm text-gray-500 pb-2'> | ||
{message} | ||
</p>} | ||
<form className='flex flex-col gap-4 mt-2'> | ||
<textarea | ||
id='text' | ||
name='text' | ||
value={textData} | ||
onChange={(e) => setTextData(e.target.value)} | ||
required | ||
rows={rows} | ||
cols={cols} | ||
className='ring-1 ring-inset ring-gray-300 rounded p-2' | ||
/> | ||
<input | ||
type='submit' | ||
className='hidden' | ||
onClick={(e) => { | ||
e.preventDefault() | ||
handleSubmit(true) | ||
}} | ||
/> | ||
</form> | ||
</> | ||
} | ||
/> | ||
) | ||
} | ||
|
||
export default TextInputModal |
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
6 changes: 6 additions & 0 deletions
6
core/src/main/java/com/rtm516/mcxboxbroadcast/core/models/auth/XstsAuthData.java
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,6 @@ | ||
package com.rtm516.mcxboxbroadcast.core.models.auth; | ||
|
||
import net.raphimc.minecraftauth.step.xbl.StepXblSisuAuthentication; | ||
|
||
public record XstsAuthData(StepXblSisuAuthentication.XblSisuTokens xstsToken, StepXblSisuAuthentication xstsAuth) { | ||
} |