Skip to content
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

18 - use dot based map cont - Man #71

Merged
merged 39 commits into from
Oct 18, 2023
Merged

Conversation

ManSangSin
Copy link
Owner

@ManSangSin ManSangSin commented Oct 17, 2023

Naming Rules

Name your PR like this: ISSUENUMBER-TITLE-YOURNAME

Description

  • Set components structure to be Home -> MyMap -> DotMap -> RhythmCodeIcon
  • svg map now includes id for each dot
  • RhythmCodeIcon now use x and y data relative to the SVG map
  • x and y data is queried from the svg using the id
  • Removed toppx and leftpx / added map_id to rhythm_codes table
  • Update api query to match database changes
  • Update readme to include instructions on how to add a new marker

Related to

Make sure you include the issue number with a hash sign # so Github can link this PR to the right issue, like this:

Addresses #18

Checklist:

  • My code follows the style guidelines of this project
  • I have carefully reviewed my own code
  • I have commented my code
  • I have updated any documentation

@ManSangSin ManSangSin requested a review from mferryRV October 17, 2023 18:46
@ManSangSin
Copy link
Owner Author

screenshot:
image

Copy link
Collaborator

@mferryRV mferryRV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not yet confident this is the right approach. I'd like to discuss two questions:

  • My understanding was that we would give each dot an ID and store the relevant ID in the database. What is the plan for transitioning away from PX-based positioning?
  • I would like to minimise the amount of interaction we have with DotMap.js. Is it possible to put DotMap inside MyMap? It was confusing to see MyMap imported but not referenced in the first 20,000 lines of the file.

@@ -0,0 +1,38 @@
/* dot map classes & ids */

/* Cuba marker - can also use id #cuba */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need these comments?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a worringly large file, to the point where git is not able to display it for my review. Are there ways around editing this file?

How often does it need to be edited?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain the reasoning for putting the MyMap component inside the DotMap component vs vice versa?

@@ -29,10 +29,10 @@ CREATE TABLE rhythms (
CONSTRAINT rhy_rhythm_code_fk FOREIGN KEY (rhythm_code_id) REFERENCES rhythm_codes (id)
);

INSERT INTO rhythm_codes (rhythm_code, location, region, leftpx, toppx) VALUES('Rumba', 'Cuba', 'Caribbean', 570, 195);
INSERT INTO rhythm_codes (rhythm_code, location, region, leftpx, toppx) VALUES('Gwo-Ka', 'Guadeloupe', 'Caribbean', 650, 180);
INSERT INTO rhythm_codes (rhythm_code, location, region, leftpx, toppx) VALUES('Rumba', 'Cuba', 'Caribbean', 728.61, 742.22);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these still PX numbers?

cursor: pointer;
}

button {
Copy link
Collaborator

@mferryRV mferryRV Oct 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this for all buttons? or is there a specific button?

background-color: rgb(255, 236, 167);
}

.menu > li > button {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this CSS belongs at the Home level - it seems like it might need to style a menu component. What is it styling?

@ManSangSin
Copy link
Owner Author

Add a readme to explain how to add a new location ID
structure: MyMap -> DotMap -> Children (location icons component)
rename leftpx toppx to match svg x / y in database

@ManSangSin ManSangSin force-pushed the US18-use-dot-based-map-cont branch from 775273d to 9c2c8f4 Compare October 18, 2023 00:56
Copy link
Owner Author

@ManSangSin ManSangSin Oct 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

screenshot of code changes for DotMap component:
image

  • moved icon component into DotMap component as discussed last night
  • I've decided to add ids to the dots inside the svg as I think its cleaner and easier to explain when adding a new point to the map (via parsing the queryselector)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this, you have to know what keys are being used from rhythmCodeObject - I'd prefer children

@ManSangSin ManSangSin requested a review from mferryRV October 18, 2023 13:35
Copy link
Collaborator

@mferryRV mferryRV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The query selector and IDs approach looks good 👍

I would prefer that RhythmCodeIcon stays in the MyMap component as a child of DotMap and we just pass children to the DotMap. It would mean nobody needs to look at or change DotMap in the future. With the current code, people would need to look deep into that SVG file to figure out what props we pass to RhythmCodeIcon. Basically I don't want anything imported or coded in DotMap.

This solution is acceptable (as we are nearing the end of the project), but I strongly recommend this change


const dotSelector = document.querySelector(`#${map_id}`).outerHTML;
const findxy = /(?!=d="m)([0-9]*.[0-9]*),([0-9]*.[0-9]*)/;
const xyData = dotSelector.match(findxy);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with this approach

@ManSangSin ManSangSin merged commit ffd22e8 into main Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants