mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-29 07:39:36 +02:00
parent
83eb42578a
commit
504e399fc1
5 changed files with 26 additions and 9 deletions
|
@ -25,7 +25,7 @@ interface ComponentProps {
|
||||||
|
|
||||||
export enum ContentType {
|
export enum ContentType {
|
||||||
category,
|
category,
|
||||||
app,
|
app
|
||||||
}
|
}
|
||||||
|
|
||||||
const Apps = (props: ComponentProps): JSX.Element => {
|
const Apps = (props: ComponentProps): JSX.Element => {
|
||||||
|
|
|
@ -37,13 +37,13 @@ const BookmarkForm = (props: ComponentProps): JSX.Element => {
|
||||||
const [useCustomIcon, setUseCustomIcon] = useState<boolean>(false);
|
const [useCustomIcon, setUseCustomIcon] = useState<boolean>(false);
|
||||||
const [customIcon, setCustomIcon] = useState<File | null>(null);
|
const [customIcon, setCustomIcon] = useState<File | null>(null);
|
||||||
const [categoryData, setCategoryData] = useState<NewCategory>({
|
const [categoryData, setCategoryData] = useState<NewCategory>({
|
||||||
name: "",
|
name: '',
|
||||||
type: "bookmarks",
|
type: 'bookmarks',
|
||||||
});
|
});
|
||||||
|
|
||||||
const [bookmarkData, setBookmarkData] = useState<NewBookmark>({
|
const [bookmarkData, setBookmarkData] = useState<NewBookmark>({
|
||||||
name: "",
|
name: '',
|
||||||
url: "",
|
url: '',
|
||||||
categoryId: -1,
|
categoryId: -1,
|
||||||
icon: '',
|
icon: '',
|
||||||
});
|
});
|
||||||
|
@ -53,7 +53,7 @@ const BookmarkForm = (props: ComponentProps): JSX.Element => {
|
||||||
if (props.category) {
|
if (props.category) {
|
||||||
setCategoryData({ name: props.category.name, type: props.category.type });
|
setCategoryData({ name: props.category.name, type: props.category.type });
|
||||||
} else {
|
} else {
|
||||||
setCategoryData({ name: "", type: "bookmarks" });
|
setCategoryData({ name: '', type: 'bookmarks' });
|
||||||
}
|
}
|
||||||
}, [props.category]);
|
}, [props.category]);
|
||||||
|
|
||||||
|
@ -68,8 +68,8 @@ const BookmarkForm = (props: ComponentProps): JSX.Element => {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setBookmarkData({
|
setBookmarkData({
|
||||||
name: "",
|
name: '',
|
||||||
url: "",
|
url: '',
|
||||||
categoryId: -1,
|
categoryId: -1,
|
||||||
icon: '',
|
icon: '',
|
||||||
});
|
});
|
||||||
|
|
|
@ -232,7 +232,7 @@ const BookmarkTable = (props: ComponentProps): JSX.Element => {
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<div className={classes.Message}>
|
<div className={classes.Message}>
|
||||||
{isCustomOrder ? (
|
{isCustomOrder ? (
|
||||||
<p>You can drag and drop single rows to reorder bookmarklication</p>
|
<p>You can drag and drop single rows to reorder bookmark</p>
|
||||||
) : (
|
) : (
|
||||||
<p>
|
<p>
|
||||||
Custom order is disabled. You can change it in{" "}
|
Custom order is disabled. You can change it in{" "}
|
||||||
|
|
|
@ -59,6 +59,13 @@ const Home = (props: ComponentProps): JSX.Element => {
|
||||||
}
|
}
|
||||||
}, [getAppCategories]);
|
}, [getAppCategories]);
|
||||||
|
|
||||||
|
// Load app categories
|
||||||
|
useEffect(() => {
|
||||||
|
if (appCategories.length === 0) {
|
||||||
|
getAppCategories();
|
||||||
|
}
|
||||||
|
}, [getAppCategories]);
|
||||||
|
|
||||||
// Load apps
|
// Load apps
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (apps.length === 0) {
|
if (apps.length === 0) {
|
||||||
|
|
|
@ -245,6 +245,16 @@ const reorderApps = (state: State, action: Action): State => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const sortApps = (state: State, action: Action): State => {
|
const sortApps = (state: State, action: Action): State => {
|
||||||
|
// const tmpCategories = [...state.categories];
|
||||||
|
|
||||||
|
// tmpCategories.forEach((category: Category) => {
|
||||||
|
// category.apps = sortData<App>(category.apps, action.payload);
|
||||||
|
// });
|
||||||
|
|
||||||
|
// return {
|
||||||
|
// ...state,
|
||||||
|
// categories: tmpCategories,
|
||||||
|
// };
|
||||||
const sortedApps = sortData<App>(state.apps, action.payload);
|
const sortedApps = sortData<App>(state.apps, action.payload);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue