mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 11:06:40 +07:00
backend: fixed loading of routes
This commit is contained in:
parent
b8431abeeb
commit
cc4dff0ca1
10 changed files with 73 additions and 74 deletions
|
@ -4,28 +4,32 @@ import { bindActionCreators } from 'redux';
|
|||
import { connect } from 'react-redux';
|
||||
import { RouteRow } from '$components/maps/RouteRow';
|
||||
import type { Route } from '$constants/types';
|
||||
import { compareDesc } from 'date-fns';
|
||||
|
||||
type Props = {
|
||||
routes: { [id: String]: Route },
|
||||
editing: Boolean,
|
||||
routes_sorted: Array<string>,
|
||||
};
|
||||
|
||||
const Component = ({ routes, editing }: Props) => (
|
||||
const Component = ({ routes, editing, routes_sorted }: Props) => (
|
||||
<div className="dialog-maplist">
|
||||
{
|
||||
Object.keys(routes).map(id => (
|
||||
<RouteRow
|
||||
editing={editing}
|
||||
{...routes[id]}
|
||||
key={id}
|
||||
/>
|
||||
routes_sorted.map(id => (
|
||||
<RouteRow
|
||||
editing={editing}
|
||||
{...routes[id]}
|
||||
key={id}
|
||||
/>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
);
|
||||
|
||||
const mapStateToProps = ({ user: { editing, user: { routes } } }) => ({
|
||||
routes, editing,
|
||||
routes,
|
||||
editing,
|
||||
routes_sorted: Object.keys(routes).sort((a, b) => compareDesc(routes[a].updated_at, routes[b].updated_at)),
|
||||
});
|
||||
|
||||
const mapDispatchToProps = dispatch => bindActionCreators({
|
||||
|
|
|
@ -11,7 +11,7 @@ export const StickersDialog = ({ setActiveSticker }: Props) => (
|
|||
<div className="helper stickers-helper">
|
||||
{
|
||||
Object.keys(STICKERS).map(set => (
|
||||
<div>
|
||||
<div key={set}>
|
||||
<div className="stickers-set-title">{STICKERS[set].title || null}</div>
|
||||
<div className="stickers-grid">
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue