-
-
Notifications
You must be signed in to change notification settings - Fork 408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Module/map/backend #524
Module/map/backend #524
Changes from 13 commits
234ddfb
b277f45
2351682
3d2a9d3
3337a04
b177936
5cc1175
3712070
f60315b
c05a62d
8e14464
5b2bcfc
9696006
dd94429
2059f05
d83c21c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { IDbDoc } from 'src/models/common.models' | ||
import { Database } from 'src/stores/database' | ||
|
||
// by default all documents saved in the database should contain | ||
// a small subset of meta, including _id, _created, and _modified fields | ||
export const DB_META_MOCK = (): IDbDoc => Database.generateDocMeta('_mocks') |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
export interface IDatabaseMapPin { | ||
id: string | ||
import { IDbDoc } from './common.models' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice. I saw this on the other models but didn't understand it, so thought I'd leave this part to you anyway 👍 |
||
|
||
export interface IDatabaseMapPin extends IDbDoc { | ||
location: ILatLng & { | ||
address: string | ||
} | ||
pinType: string | ||
} | ||
|
||
export interface IMapPin { | ||
id: string | ||
_id: string | ||
location: ILatLng & { | ||
address: string | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,7 +51,7 @@ class Controls extends React.Component<IProps> { | |
position: 'absolute', | ||
left: '10%', | ||
borderRadius: '5px', | ||
zIndex: 99999, | ||
zIndex: 2, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. haha, good hack fix is good |
||
marginTop: '30px', | ||
}} | ||
> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,7 +67,7 @@ class MapView extends React.Component<IProps, IState> { | |
center={[center.lat, center.lng]} | ||
zoom={zoom} | ||
maxZoom={18} | ||
style={{ height: '100%' }} | ||
style={{ height: '100%', zIndex: 1 }} | ||
onMove={this.updateBoundingBox} | ||
> | ||
<TileLayer | ||
|
@@ -79,6 +79,15 @@ class MapView extends React.Component<IProps, IState> { | |
</Map> | ||
) | ||
} | ||
|
||
static defaultProps: Partial<IProps> = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I get what you mean on slack now. Yes, for all intents and purposes, the click binders are actually not "required". It is required for a functioning application, but it's not required in the grand scheme of things. In theory this(ese) components could be a bit more generic, and could thus be thrown into the components folder. Specifically the map view stuff. Hrrmm, food for thought another day though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, my main reason was so I could include it in the profile module without having to write a click handler (was feeling lazy), but I think it also does give that option of making even more standalone. But yeah, later days. |
||
onBoundingBoxChange: () => null, | ||
onPinClicked: () => null, | ||
pins: [], | ||
filters: [], | ||
center: { lat: 51.0, lng: 19.0 }, | ||
zoom: 3, | ||
} | ||
} | ||
|
||
export { MapView } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like something that should be done by state and @observer instead of waiting on the store to return something. What you are trying to achieve here should be in a lib, not in a store.
If you're wanting to use the store, then Generally speaking, you would have a placeholder, then on
componentDidMount
you would tell the store to getUserAvatar. The function would then do this async, set something inside it's internal state for on an @observeable, to which you would then bind that into the component using observer. I see that the code is referenced in the store again in a helper function, but that should really not be public, or should be libbed as above.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense. It used to be an async function which is why it was there (had to make a call to the database to get urls), but then I realised all the database method was actually doing was reformatting a string in a pretty obvious way. Will change.