1
0
Fork 0
mirror of https://github.com/pawelmalak/flame.git synced 2025-07-30 08:09:35 +02:00
This commit is contained in:
François Darveau 2022-04-15 14:40:47 -04:00
commit 4c827d2c91
85 changed files with 1657 additions and 568 deletions

View file

@ -41,7 +41,7 @@ export const AppsTable = ({ openFormForUpdating }: Props): JSX.Element => {
}, [categoryInEdit]);
// Drag and drop handler
const dragEndHanlder = (result: DropResult): void => {
const dragEndHandler = (result: DropResult): void => {
if (config.useOrdering !== 'orderId') {
createNotification({
title: 'Error',
@ -109,7 +109,7 @@ export const AppsTable = ({ openFormForUpdating }: Props): JSX.Element => {
)}
{categoryInEdit && (
<DragDropContext onDragEnd={dragEndHanlder}>
<DragDropContext onDragEnd={dragEndHandler}>
<Droppable droppableId="apps">
{(provided) => (
<Table

View file

@ -26,7 +26,7 @@ export const AppsForm = ({
const { categories } = useSelector((state: State) => state.apps);
const dispatch = useDispatch();
const { addApp, updateApp, createNotification } =
const { addApp, updateApp, setEditApp, createNotification } =
bindActionCreators(actionCreators, dispatch);
const [useCustomIcon, toggleUseCustomIcon] = useState<boolean>(false);
@ -65,12 +65,25 @@ export const AppsForm = ({
const formSubmitHandler = (e: FormEvent): void => {
e.preventDefault();
for (let field of ['name', 'url', 'icon'] as const) {
if (/^ +$/.test(formData[field])) {
createNotification({
title: 'Error',
message: `Field cannot be empty: ${field}`,
});
return;
}
}
const createFormData = (): FormData => {
const data = new FormData();
if (customIcon) {
data.append('icon', customIcon);
}
data.append('name', formData.name);
data.append('description', formData.description);
data.append('url', formData.url);
data.append('categoryId', `${formData.categoryId}`);
data.append('isPublic', `${formData.isPublic ? 1 : 0}`);

View file

@ -41,7 +41,7 @@ export const AppsTable = ({ openFormForUpdating }: Props): JSX.Element => {
}, [categoryInEdit]);
// Drag and drop handler
const dragEndHanlder = (result: DropResult): void => {
const dragEndHandler = (result: DropResult): void => {
if (config.useOrdering !== 'orderId') {
createNotification({
title: 'Error',
@ -109,7 +109,7 @@ export const AppsTable = ({ openFormForUpdating }: Props): JSX.Element => {
)}
{categoryInEdit && (
<DragDropContext onDragEnd={dragEndHanlder}>
<DragDropContext onDragEnd={dragEndHandler}>
<Droppable droppableId="apps">
{(provided) => (
<Table

View file

@ -40,7 +40,7 @@ export const CategoryTable = ({ openFormForUpdating }: Props): JSX.Element => {
}, [categories]);
// Drag and drop handler
const dragEndHanlder = (result: DropResult): void => {
const dragEndHandler = (result: DropResult): void => {
if (config.useOrdering !== 'orderId') {
createNotification({
title: 'Error',
@ -95,12 +95,12 @@ export const CategoryTable = ({ openFormForUpdating }: Props): JSX.Element => {
) : (
<p>
Custom order is disabled. You can change it in the{' '}
<Link to="/settings/interface">settings</Link>
<Link to="/settings/general">settings</Link>
</p>
)}
</Message>
<DragDropContext onDragEnd={dragEndHanlder}>
<DragDropContext onDragEnd={dragEndHandler}>
<Droppable droppableId="categories">
{(provided) => (
<Table