Changed some messages and buttons to make it easier to open bookmarks editor

This commit is contained in:
Paweł Malak 2021-12-02 14:12:23 +01:00
parent 2ca90a18e1
commit 068c8ab2e7
10 changed files with 76 additions and 82 deletions

View file

@ -1,3 +1,6 @@
### v2.1.1 (TBA)
- Changed some messages and buttons to make it easier to open bookmarks editor ([#239](https://github.com/pawelmalak/flame/issues/239))
### v2.1.0 (2021-11-26) ### v2.1.0 (2021-11-26)
- Added option to set custom order for bookmarks ([#43](https://github.com/pawelmalak/flame/issues/43)) and ([#187](https://github.com/pawelmalak/flame/issues/187)) - Added option to set custom order for bookmarks ([#43](https://github.com/pawelmalak/flame/issues/43)) and ([#187](https://github.com/pawelmalak/flame/issues/187))
- Added support for .ico files for custom icons ([#209](https://github.com/pawelmalak/flame/issues/209)) - Added support for .ico files for custom icons ([#209](https://github.com/pawelmalak/flame/issues/209))

View file

@ -1,29 +0,0 @@
.TableActions {
display: flex;
align-items: center;
}
.TableAction {
width: 22px;
}
.TableAction:hover {
cursor: pointer;
}
.Message {
width: 100%;
display: flex;
justify-content: center;
align-items: baseline;
color: var(--color-primary);
margin-bottom: 20px;
}
.Message a {
color: var(--color-accent);
}
.Message a:hover {
cursor: pointer;
}

View file

@ -17,8 +17,7 @@ import { actionCreators } from '../../../store';
import { App } from '../../../interfaces'; import { App } from '../../../interfaces';
// Other // Other
import classes from './AppTable.module.css'; import { Message, Table } from '../../UI';
import { Table } from '../../UI';
import { TableActions } from '../../Actions/TableActions'; import { TableActions } from '../../Actions/TableActions';
interface Props { interface Props {
@ -89,7 +88,7 @@ export const AppTable = (props: Props): JSX.Element => {
return ( return (
<Fragment> <Fragment>
<div className={classes.Message}> <Message isPrimary={false}>
{config.useOrdering === 'orderId' ? ( {config.useOrdering === 'orderId' ? (
<p>You can drag and drop single rows to reorder application</p> <p>You can drag and drop single rows to reorder application</p>
) : ( ) : (
@ -98,7 +97,7 @@ export const AppTable = (props: Props): JSX.Element => {
<Link to="/settings/interface">settings</Link> <Link to="/settings/interface">settings</Link>
</p> </p>
)} )}
</div> </Message>
<DragDropContext onDragEnd={dragEndHanlder}> <DragDropContext onDragEnd={dragEndHanlder}>
<Droppable droppableId="apps"> <Droppable droppableId="apps">

View file

@ -22,7 +22,10 @@ interface Props {
export const BookmarkCard = (props: Props): JSX.Element => { export const BookmarkCard = (props: Props): JSX.Element => {
const { category, fromHomepage = false } = props; const { category, fromHomepage = false } = props;
const { config } = useSelector((state: State) => state.config); const {
config: { config },
auth: { isAuthenticated },
} = useSelector((state: State) => state);
const dispatch = useDispatch(); const dispatch = useDispatch();
const { setEditCategory } = bindActionCreators(actionCreators, dispatch); const { setEditCategory } = bindActionCreators(actionCreators, dispatch);
@ -30,9 +33,11 @@ export const BookmarkCard = (props: Props): JSX.Element => {
return ( return (
<div className={classes.BookmarkCard}> <div className={classes.BookmarkCard}>
<h3 <h3
className={fromHomepage ? '' : classes.BookmarkHeader} className={
fromHomepage || !isAuthenticated ? '' : classes.BookmarkHeader
}
onClick={() => { onClick={() => {
if (!fromHomepage) { if (!fromHomepage && isAuthenticated) {
setEditCategory(category); setEditCategory(category);
} }
}} }}

View file

@ -14,7 +14,14 @@ import { Category, Bookmark } from '../../interfaces';
import classes from './Bookmarks.module.css'; import classes from './Bookmarks.module.css';
// UI // UI
import { Container, Headline, ActionButton, Spinner, Modal } from '../UI'; import {
Container,
Headline,
ActionButton,
Spinner,
Modal,
Message,
} from '../UI';
// Components // Components
import { BookmarkGrid } from './BookmarkGrid/BookmarkGrid'; import { BookmarkGrid } from './BookmarkGrid/BookmarkGrid';
@ -121,6 +128,11 @@ export const Bookmarks = (props: Props): JSX.Element => {
} }
}; };
const finishEditing = () => {
setShowTable(false);
setEditCategory(null);
};
return ( return (
<Container> <Container>
<Modal isOpen={modalIsOpen} setIsOpen={toggleModal}> <Modal isOpen={modalIsOpen} setIsOpen={toggleModal}>
@ -150,14 +162,24 @@ export const Bookmarks = (props: Props): JSX.Element => {
icon="mdiPencil" icon="mdiPencil"
handler={() => showTableForEditing(ContentType.category)} handler={() => showTableForEditing(ContentType.category)}
/> />
<ActionButton {showTable && tableContentType === ContentType.bookmark && (
name="Edit Bookmarks" <ActionButton
icon="mdiPencil" name="Finish Editing"
handler={() => showTableForEditing(ContentType.bookmark)} icon="mdiPencil"
/> handler={finishEditing}
/>
)}
</div> </div>
)} )}
{categories.length && isAuthenticated && !showTable ? (
<Message isPrimary={false}>
Click on category name to edit its bookmarks
</Message>
) : (
<></>
)}
{loading ? ( {loading ? (
<Spinner /> <Spinner />
) : !showTable ? ( ) : !showTable ? (

View file

@ -15,11 +15,8 @@ import { actionCreators } from '../../../store';
// Typescript // Typescript
import { Bookmark, Category } from '../../../interfaces'; import { Bookmark, Category } from '../../../interfaces';
// CSS
import classes from './Table.module.css';
// UI // UI
import { Table } from '../../UI'; import { Message, Table } from '../../UI';
import { TableActions } from '../../Actions/TableActions'; import { TableActions } from '../../Actions/TableActions';
import { bookmarkTemplate } from '../../../utility'; import { bookmarkTemplate } from '../../../utility';
@ -108,18 +105,14 @@ export const BookmarksTable = ({ openFormForUpdating }: Props): JSX.Element => {
return ( return (
<Fragment> <Fragment>
{!categoryInEdit ? ( {!categoryInEdit ? (
<div className={classes.Message}> <Message isPrimary={false}>
<p> Switch to grid view and click on the name of category you want to edit
Switch to grid view and click on the name of category you want to </Message>
edit
</p>
</div>
) : ( ) : (
<div className={classes.Message}> <Message isPrimary={false}>
<p> Editing bookmarks from&nbsp;<span>{categoryInEdit.name}</span>
Editing bookmarks from <span>{categoryInEdit.name}</span> category &nbsp;category
</p> </Message>
</div>
)} )}
{categoryInEdit && ( {categoryInEdit && (

View file

@ -16,11 +16,8 @@ import { actionCreators } from '../../../store';
// Typescript // Typescript
import { Bookmark, Category } from '../../../interfaces'; import { Bookmark, Category } from '../../../interfaces';
// CSS
import classes from './Table.module.css';
// UI // UI
import { Table } from '../../UI'; import { Message, Table } from '../../UI';
import { TableActions } from '../../Actions/TableActions'; import { TableActions } from '../../Actions/TableActions';
interface Props { interface Props {
@ -99,7 +96,7 @@ export const CategoryTable = ({ openFormForUpdating }: Props): JSX.Element => {
return ( return (
<Fragment> <Fragment>
<div className={classes.Message}> <Message isPrimary={false}>
{config.useOrdering === 'orderId' ? ( {config.useOrdering === 'orderId' ? (
<p>You can drag and drop single rows to reorder categories</p> <p>You can drag and drop single rows to reorder categories</p>
) : ( ) : (
@ -108,7 +105,7 @@ export const CategoryTable = ({ openFormForUpdating }: Props): JSX.Element => {
<Link to="/settings/interface">settings</Link> <Link to="/settings/interface">settings</Link>
</p> </p>
)} )}
</div> </Message>
<DragDropContext onDragEnd={dragEndHanlder}> <DragDropContext onDragEnd={dragEndHanlder}>
<Droppable droppableId="categories"> <Droppable droppableId="categories">

View file

@ -1,17 +0,0 @@
.Message {
width: 100%;
display: flex;
justify-content: center;
align-items: baseline;
color: var(--color-primary);
margin-bottom: 20px;
}
.Message a,
.Message span {
color: var(--color-accent);
}
.Message a:hover {
cursor: pointer;
}

View file

@ -6,3 +6,21 @@
color: var(--color-accent); color: var(--color-accent);
font-weight: 600; font-weight: 600;
} }
.messageCenter {
width: 100%;
display: flex;
justify-content: center;
align-items: baseline;
color: var(--color-primary);
margin-bottom: 20px;
}
.messageCenter a,
.messageCenter span {
color: var(--color-accent);
}
.messageCenter a:hover {
cursor: pointer;
}

View file

@ -4,8 +4,11 @@ import classes from './Message.module.css';
interface Props { interface Props {
children: ReactNode; children: ReactNode;
isPrimary?: boolean;
} }
export const Message = ({ children }: Props): JSX.Element => { export const Message = ({ children, isPrimary = true }: Props): JSX.Element => {
return <p className={classes.message}>{children}</p>; const style = isPrimary ? classes.message : classes.messageCenter;
return <p className={style}>{children}</p>;
}; };