feat(share, config): more variables, placeholder and reset default (#132)

* More email share vars + unfinished placeolders config

{desc} {expires} vars
(unfinished) config placeholder vals

* done

* migrate

* edit seed

* removed comments

* refactor: replace dependecy `luxon` with `moment`

* update shareRecipientsMessage message

* chore: remove `luxon`

* fix: grammatically incorrect `shareRecipientsMessage` message

* changed to defaultValue and value instead

* fix: don't expose defaultValue to non admin user

* fix: update default value if default value changes

* refactor: set config value to null instead of a empty string

* refactor: merge two migrations into one

* fix value check empty

---------

Co-authored-by: Elias Schneider <login@eliasschneider.com>
This commit is contained in:
iUnstable0
2023-03-23 14:31:21 +07:00
committed by GitHub
parent a0d1d98e24
commit beece56327
12 changed files with 149 additions and 73 deletions

View File

@@ -67,7 +67,7 @@ export default function AppShellDemo() {
toast.success("Configurations updated successfully");
})
.catch(toast.axiosError);
config.refresh();
void config.refresh();
}
};
@@ -75,8 +75,12 @@ export default function AppShellDemo() {
const index = updatedConfigVariables.findIndex(
(item) => item.key === configVariable.key
);
if (index > -1) {
updatedConfigVariables[index] = configVariable;
updatedConfigVariables[index] = {
...updatedConfigVariables[index],
...configVariable,
};
} else {
setUpdatedConfigVariables([...updatedConfigVariables, configVariable]);
}
@@ -132,9 +136,24 @@ export default function AppShellDemo() {
<Title order={6}>
{configVariableToFriendlyName(configVariable.name)}
</Title>
<Text color="dimmed" size="sm" mb="xs">
{configVariable.description}
</Text>
{configVariable.description.split("\n").length == 1 ? (
<Text color="dimmed" size="sm" mb="xs">
{configVariable.description}
</Text>
) : (
configVariable.description.split("\n").map((line) => (
<Text
key={line}
color="dimmed"
size="sm"
style={{
marginBottom: line === "" ? "1rem" : "0",
}}
>
{line}
</Text>
))
)}
</Stack>
<Stack></Stack>
<Box style={{ width: isMobile ? "100%" : "50%" }}>