Clear changed settings on save, styling improvements on Homepage and blog page
This commit is contained in:
parent
201ace0134
commit
081d56c597
|
|
@ -29,6 +29,11 @@ h1 {
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
padding: 0px;
|
||||||
|
margin: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
h4 {
|
h4 {
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
|
|
@ -173,13 +178,36 @@ a {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.blogBox h1 {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blogBox h2 {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blogBox h3 {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
.blogEntryGrid {
|
.blogEntryGrid {
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
max-width: 100%;
|
||||||
|
min-height: 100%;
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 20px;
|
gap: 20px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
grid-auto-flow: column;
|
grid-auto-flow: row;
|
||||||
grid-auto-rows: var(--blog-card-height);
|
grid-auto-rows: var(--blog-card-height);
|
||||||
grid-auto-columns: var(--blog-card-width);
|
grid-auto-columns: var(--blog-card-width);
|
||||||
|
grid-template-columns: repeat(auto-fill, var(--blog-card-width));
|
||||||
}
|
}
|
||||||
|
|
||||||
.blogEntryCard {
|
.blogEntryCard {
|
||||||
|
|
@ -239,6 +267,7 @@ a {
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
background: var(--background-image);
|
background: var(--background-image);
|
||||||
|
overflow-y: scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
.centeredBoxArea {
|
.centeredBoxArea {
|
||||||
|
|
|
||||||
|
|
@ -36,9 +36,8 @@ export default function Home() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="standardHorizontalTilingGrid">
|
<div className="standardHorizontalTilingGrid blogBox">
|
||||||
<TilingItem>
|
<TilingItem>
|
||||||
<h1>Now on blog page!</h1>
|
|
||||||
<div
|
<div
|
||||||
dangerouslySetInnerHTML={{
|
dangerouslySetInnerHTML={{
|
||||||
__html: DOMPurify.sanitize(blogContents),
|
__html: DOMPurify.sanitize(blogContents),
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ export default function Home() {
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
fetch(
|
fetch(
|
||||||
"http://127.0.0.1:8000/api/user/blog/cardInfo/range?rangeStart=1&rangeEnd=25&sortByLatest=true",
|
"http://127.0.0.1:8000/api/user/blog/cardInfo/range?rangeStart=1&rangeEnd=50&sortByLatest=true",
|
||||||
{
|
{
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,11 @@ interface Props {
|
||||||
function renderCurrentSetting(setting: string, changedSettingsHook: object) {
|
function renderCurrentSetting(setting: string, changedSettingsHook: object) {
|
||||||
switch (setting) {
|
switch (setting) {
|
||||||
case "Account":
|
case "Account":
|
||||||
return <AccountSetting changedSettingsHook={changedSettingsHook}></AccountSetting>;
|
return (
|
||||||
|
<AccountSetting
|
||||||
|
changedSettingsHook={changedSettingsHook}
|
||||||
|
></AccountSetting>
|
||||||
|
);
|
||||||
case "Security":
|
case "Security":
|
||||||
return <SecuritySetting></SecuritySetting>;
|
return <SecuritySetting></SecuritySetting>;
|
||||||
default:
|
default:
|
||||||
|
|
@ -35,7 +39,6 @@ export default function Home({ authTokenStorageHandler }: Props) {
|
||||||
setChangedSettings,
|
setChangedSettings,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
if (!authTokenStorageHandler.authTokenValue) {
|
if (!authTokenStorageHandler.authTokenValue) {
|
||||||
return <Navigate to="/home"></Navigate>;
|
return <Navigate to="/home"></Navigate>;
|
||||||
}
|
}
|
||||||
|
|
@ -43,23 +46,23 @@ export default function Home({ authTokenStorageHandler }: Props) {
|
||||||
function onSettingsSave(formEvent) {
|
function onSettingsSave(formEvent) {
|
||||||
formEvent.preventDefault();
|
formEvent.preventDefault();
|
||||||
|
|
||||||
|
for (let [key, value] of Object.entries(changedSettings)) {
|
||||||
for (let [key, value] of Object.entries(changedSettings)) {
|
fetch("http://127.0.0.1:8000/api/user/settings/change/" + key, {
|
||||||
fetch("http://127.0.0.1:8000/api/user/settings/change/" + key, {
|
method: "PUT",
|
||||||
method: "PUT",
|
headers: {
|
||||||
headers: {
|
"Content-Type": "application/json",
|
||||||
"Content-Type": "application/json",
|
},
|
||||||
},
|
body: JSON.stringify({
|
||||||
body: JSON.stringify({
|
authToken: authTokenStorageHandler.authTokenValue,
|
||||||
"authToken": authTokenStorageHandler.authTokenValue,
|
newValue: value,
|
||||||
"newValue": value,
|
}),
|
||||||
}),
|
})
|
||||||
})
|
.then((response) => response.json())
|
||||||
.then((response) => response.json())
|
.then((responseParsed: Object) => {
|
||||||
.then((responseParsed: Object) => {
|
console.log(responseParsed);
|
||||||
console.log(responseParsed);
|
setChangedSettings({});
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -80,14 +83,16 @@ export default function Home({ authTokenStorageHandler }: Props) {
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<hr></hr>
|
<hr></hr>
|
||||||
<form className="currentSettingBox" onSubmit={onSettingsSave}>
|
<form className="currentSettingBox" onSubmit={onSettingsSave}>
|
||||||
<div className="currentSetting">
|
<div className="currentSetting">
|
||||||
{renderCurrentSetting(currentSetting, changedSettingsHook)}
|
{renderCurrentSetting(currentSetting, changedSettingsHook)}
|
||||||
</div>
|
</div>
|
||||||
{Object.keys(changedSettings).length > 0 ? ( <button type="submit">Save</button> ) : null }
|
{Object.keys(changedSettings).length > 0 ? (
|
||||||
<p>{JSON.stringify(changedSettings)}</p>
|
<button type="submit">Save</button>
|
||||||
<p>{Object.keys(changedSettings).length}</p>
|
) : null}
|
||||||
</form>
|
<p>{JSON.stringify(changedSettings)}</p>
|
||||||
|
<p>{Object.keys(changedSettings).length}</p>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</TilingItem>
|
</TilingItem>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue