-
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.
add PaymentPageConfig, fix image scaling in alerts
- Loading branch information
Showing
12 changed files
with
215 additions
and
28 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
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 |
---|---|---|
@@ -1,28 +1,48 @@ | ||
import React from "react"; | ||
import "./css/Toolbar.css"; | ||
import { useNavigate } from "react-router"; | ||
|
||
export default function Toolbar() { | ||
enum Page { | ||
WIDGETS, | ||
GATEWAYS, | ||
PAYMENTPAGE, | ||
} | ||
|
||
export default function Toolbar({ page }: { page: Page }) { | ||
const navigate = useNavigate(); | ||
return ( | ||
<div className="toolbar"> | ||
<div className="toolbar-title"> | ||
<img className="oda-logo" src={`${process.env.PUBLIC_URL}/favicon.png`}/> | ||
</div> | ||
<button className="toolbar-button"> | ||
<span className="material-symbols-sharp">rss_feed</span> | ||
<span className="toolbar-button-title">News</span> | ||
</button> | ||
<button className="toolbar-button active"> | ||
<img | ||
className="oda-logo" | ||
src={`${process.env.PUBLIC_URL}/favicon.png`} | ||
/> | ||
</div> | ||
<button | ||
className={`toolbar-button ${page === Page.WIDGETS ? "active" : ""}`} | ||
onClick={() => navigate(`/configuration/widgets`)} | ||
> | ||
<span className="material-symbols-sharp">widgets</span> | ||
<span className="toolbar-button-title">Widgets</span> | ||
</button> | ||
<button className="toolbar-button"> | ||
<span className="material-symbols-sharp">credit_card</span> | ||
<span className="toolbar-button-title">Payment Gateways</span> | ||
</button> | ||
<button className="toolbar-button"> | ||
<button | ||
className={`toolbar-button ${ | ||
page === Page.PAYMENTPAGE ? "active" : "" | ||
}`} | ||
onClick={() => navigate(`/configuration/payment-page`)} | ||
> | ||
<span className="material-symbols-sharp">language</span> | ||
<span className="toolbar-button-title">Donation page</span> | ||
</button> | ||
<button | ||
className={`toolbar-button ${page === Page.GATEWAYS ? "active" : ""}`} | ||
onClick={() => navigate(`/configuration/gateways`)} | ||
> | ||
<span className="material-symbols-sharp">credit_card</span> | ||
<span className="toolbar-button-title">Payment Gateways</span> | ||
</button> | ||
</div> | ||
); | ||
} | ||
|
||
export { Page }; |
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 |
---|---|---|
@@ -1,3 +1,8 @@ | ||
.configuration-container { | ||
height: 100%; | ||
display: flex; | ||
} | ||
|
||
.widget-settings { | ||
margin-top: 10px; | ||
color: white; | ||
|
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
52 changes: 52 additions & 0 deletions
52
src/components/PaymentPageConfig/PaymentPageConfig.module.css
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,52 @@ | ||
.paymentpageconfig { | ||
color: white; | ||
margin-left: 100px; | ||
margin-right: 100px; | ||
padding-top: 50px; | ||
padding-left: 20px; | ||
padding-right: 20px; | ||
flex: 1 0 auto; | ||
margin-top: 10px; | ||
} | ||
|
||
.paymentpage { | ||
height: 100%; | ||
display: flex; | ||
} | ||
|
||
.widgetsettingsitem { | ||
display: flex; | ||
justify-content: space-between; | ||
margin-bottom: 20px; | ||
} | ||
|
||
.widgetsettingsname { | ||
flex: 1 0 auto; | ||
} | ||
|
||
.widgetsettingsvalue { | ||
display: inline-block; | ||
width: 120px; | ||
border-radius: 5px; | ||
border: 1px solid #684aff; | ||
background: none; | ||
color: white; | ||
text-align: center; | ||
} | ||
|
||
.widgetsettingsvalue:focus-visible, | ||
.widgetsettingsvalue:focus { | ||
outline:none; | ||
} | ||
|
||
.backgroundimage { | ||
width: 400px; | ||
height: 300px; | ||
display: inline-block; | ||
flex: 0 0 auto; | ||
border: 1px solid #684aff; | ||
} | ||
|
||
.backgroundimage:hover { | ||
cursor:pointer; | ||
} |
107 changes: 107 additions & 0 deletions
107
src/components/PaymentPageConfig/PaymentPageConfigComponent.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,107 @@ | ||
import React, { ChangeEvent, useState } from "react"; | ||
import Toolbar, { Page } from "../ConfigurationPage/Toolbar"; | ||
import classes from "./PaymentPageConfig.module.css"; | ||
import { useLoaderData, useNavigate } from "react-router"; | ||
import axios from "axios"; | ||
|
||
const backgroundColor = ( | ||
<style | ||
dangerouslySetInnerHTML={{ | ||
__html: `html, body {background-color: #0c122e; height: 100%;}`, | ||
}} | ||
/> | ||
); | ||
|
||
function uploadFile(file, name) { | ||
return axios.put( | ||
`${process.env.REACT_APP_FILE_API_ENDPOINT}/files/${name}?public=true`, | ||
{ file: file }, | ||
{ | ||
headers: { | ||
"Content-Type": "multipart/form-data", | ||
}, | ||
}, | ||
); | ||
} | ||
|
||
export default function PaymentPageConfigComponent({}: {}) { | ||
const { recipientId } = useLoaderData(); | ||
const navigate = useNavigate(); | ||
const [isRequestsEnabled, setRequestsEnabled] = useState(false); | ||
const handleBackUpload = (e: ChangeEvent<HTMLInputElement>) => { | ||
if (e.target.files) { | ||
const file = e.target.files[0]; | ||
console.log(file); | ||
uploadFile(file, `back-${recipientId}.jpg`).then(() => navigate(0)); | ||
} | ||
}; | ||
const handleLogoUpload = (e: ChangeEvent<HTMLInputElement>) => { | ||
if (e.target.files) { | ||
const file = e.target.files[0]; | ||
console.log(file); | ||
uploadFile(file, `logo-${recipientId}.png`).then(() => navigate(0)); | ||
} | ||
}; | ||
|
||
const handleTogglingRequests = (e: ChangeEvent<HTMLSelectElement>) => { | ||
if (e.target.value) { | ||
setRequestsEnabled(e.target.value === "enabled"); | ||
} | ||
}; | ||
|
||
return ( | ||
<div className={classes.paymentpage}> | ||
{backgroundColor} | ||
<Toolbar page={Page.PAYMENTPAGE} /> | ||
<div className={classes.paymentpageconfig}> | ||
<div className={classes.widgetsettingsitem}> | ||
<div className={classes.widgetsettingsname}>Фоновое изображение</div> | ||
<label className="upload-button"> | ||
<input type="file" onChange={handleBackUpload} /> | ||
<img | ||
className={classes.backgroundimage} | ||
src={`${ | ||
process.env.REACT_APP_CDN_ENDPOINT | ||
}/back-${recipientId}.jpg?random=${Date.now()}`} | ||
/> | ||
</label> | ||
</div> | ||
<div className={classes.widgetsettingsitem}> | ||
<div className={classes.widgetsettingsname}>Логотип канала</div> | ||
<label className="upload-button"> | ||
<input type="file" onChange={handleLogoUpload} /> | ||
<img | ||
className={classes.backgroundimage} | ||
src={`${ | ||
process.env.REACT_APP_CDN_ENDPOINT | ||
}/logo-${recipientId}.png?random=${Date.now()}`} | ||
/> | ||
</label> | ||
</div> | ||
<div className={classes.widgetsettingsitem}> | ||
<div className={classes.widgetsettingsname}> | ||
Реквесты музыки/видео | ||
</div> | ||
<select | ||
value={isRequestsEnabled ? "enabled" : "disabled"} | ||
className="widget-settings-value select" | ||
style={{ width: "120px" }} | ||
onChange={handleTogglingRequests} | ||
> | ||
<option key="enabled">enabled</option> | ||
<option key="disabled">disabled</option> | ||
</select> | ||
</div> | ||
<div className={classes.widgetsettingsitem}> | ||
<div className={classes.widgetsettingsname}> | ||
Стоимость реквестов (за одно видео, в рублях) | ||
</div> | ||
<input | ||
type="number" | ||
className={classes.widgetsettingsvalue} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
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