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

[Map] add polyline support #2340

Merged
merged 1 commit into from
Nov 23, 2024
Merged

Conversation

sblondeau
Copy link
Contributor

@sblondeau sblondeau commented Nov 4, 2024

Q A
Bug fix? no
New feature? yes
Issues Fix #...
License MIT

Add polyline support to Map for Leaflet and GoogleMap (useful e.g. for itinerary drawing)

public function index(): Response
    {
        $map = (new Map('default'))
            ->center(new Point(45.7534031, 4.8295061))
            ->zoom(6)

            ->addPolyline(
                new Polyline(
                    title: 'my title',
                    points: [
                        new Point(48.8566, 2.3522),
                        new Point(45.7640, 4.8357),
                        new Point(43.2965, 5.3698),

                    ]
                )
            )
      ;          
        return $this->render('hom/index.html.twig', [
            'map' => $map,
        ]);;
    }

image

@sblondeau sblondeau requested a review from Kocal as a code owner November 4, 2024 21:19
@carsonbot carsonbot added Feature New Feature Status: Needs Review Needs to be reviewed labels Nov 4, 2024
Copy link

github-actions bot commented Nov 4, 2024

📊 Packages dist files size difference

Thanks for the PR! Here is the difference in size of the packages dist files between the base branch and the PR.
Please review the changes and make sure they are expected.

FileBefore (Size / Gzip)After (Size / Gzip)
Map
abstract_map_controller.d.ts 3.31 kB / 821 B 4.45 kB+34% 📈 / 905 B+10% 📈
abstract_map_controller.js 3.23 kB / 843 B 4.31 kB+33% 📈 / 976 B+16% 📈
Map (Bridge Google)
map_controller.d.ts 2.19 kB / 733 B 2.67 kB+22% 📈 / 794 B+8% 📈
map_controller.js 8.7 kB / 1.95 kB 10.38 kB+19% 📈 / 2.14 kB+9% 📈
Map (Bridge Leaflet)
map_controller.d.ts 1.57 kB / 579 B 1.99 kB+27% 📈 / 649 B+12% 📈
map_controller.js 7.2 kB / 2.06 kB 8.8 kB+22% 📈 / 2.24 kB+9% 📈

@WebMamba
Copy link
Contributor

WebMamba commented Nov 4, 2024

Hey, thanks a lot for this PR @sblondeau! Could you please add more info about this new feature to your PR description? Some screenshots, details and what you trying to achieve! Thannnnnks 😁

@sblondeau sblondeau changed the title add polyline support [Map] add polyline support Nov 5, 2024
Copy link
Member

@Kocal Kocal left a comment

Choose a reason for hiding this comment

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

Thanks for the feature, I didn't even know that "polyline" existed :)

I've added some comments that must be resolved if we want to merge your work.

Also, a lot of CI checks are failing, can you take a look please? Thanks!

src/Map/doc/index.rst Outdated Show resolved Hide resolved
src/Map/src/Bridge/Google/assets/src/map_controller.ts Outdated Show resolved Hide resolved
src/Map/src/Twig/MapRuntime.php Outdated Show resolved Hide resolved
@carsonbot carsonbot added Status: Needs Work Additional work is needed and removed Status: Needs Review Needs to be reviewed labels Nov 5, 2024
@Kocal Kocal added the Map label Nov 5, 2024
src/Map/CHANGELOG.md Outdated Show resolved Hide resolved
src/Map/src/Polyline.php Outdated Show resolved Hide resolved
src/Map/src/Polyline.php Outdated Show resolved Hide resolved
@carsonbot carsonbot added Status: Needs Review Needs to be reviewed and removed Status: Needs Work Additional work is needed labels Nov 9, 2024
@sblondeau
Copy link
Contributor Author

Hello, I tried a lot of things but some tests (js ans php) failed and I do not understand why :(
If someone has some time to investigate...
Thanks :-)

@Kocal
Copy link
Member

Kocal commented Nov 11, 2024

Hi @sblondeau, where are stuck?

Please ensure to rebase your branch from the latest 2.x quite often, but also try to run some yarn scripts to easy your development:

yarn lint
yarn format
yarn workspaces foreach -Rp --from '{src/Map/assets,src/Map/src/Bridge/Google/assets,src/Map/src/Bridge/Leaflet/assets}' run build
yarn workspaces foreach -Rp --from '{src/Map/assets,src/Map/src/Bridge/Google/assets,src/Map/src/Bridge/Leaflet/assets}' run test

Also, please start to squash your commits, we don't want to see commits 1517fe1 (#2340) like this because it will spam the history for nothing (meaning, harder to blame if necessary).

Thanks!

@sblondeau sblondeau force-pushed the feat/add-polylines branch 2 times, most recently from 829363a to 4e092e3 Compare November 16, 2024 22:45
@sblondeau
Copy link
Contributor Author

@Kocal thanks for your help with the yarn command (it is not easy to guess them ;-) )
My code works loclaly but I do not understand how to correctly launch tests. I have a failing test with GoogleMap. Sorry if my question sounds stupid but I do not understand how to correctly contribute with this part, should I work in ux map repo or in the bridge repo ? It is frustrating to be stuck so close to the end ;-) Thanks for your help

@Kocal
Copy link
Member

Kocal commented Nov 19, 2024

@Kocal thanks for your help with the yarn command (it is not easy to guess them ;-) )

Well, in fact

yarn workspaces foreach -Rp --from '{src/Map/assets,src/Map/src/Bridge/Google/assets,src/Map/src/Bridge/Leaflet/assets}' run build

is simply a shortcut to:

(cd src/Map/assets && yarn build)
(cd src/Map/src/Bridge/Google/assets && yarn build)
(cd src/Map/src/Bridge/Leaflet/assets && yarn build)

😛

My code works loclaly but I do not understand how to correctly launch tests. I have a failing test with GoogleMap. Sorry if my question sounds stupid but I do not understand how to correctly contribute with this part, should I work in ux map repo or in the bridge repo ?

Yes! You should work in the UX repository, symfony/ux-* are supposed to be read-only, but it looks like it is not the case.

To run JS tests for Google, you can run cd src/Map/src/Bridge/Google/assets && yarn test.

Keep up the good work! But... I predict you will have a lot of conflicts when #2385 will be merged :P

Kocal added a commit that referenced this pull request Nov 20, 2024
…tories (Kocal)

This PR was merged into the 2.x branch.

Discussion
----------

Add PR template and auto-close PR on subtree split repositories

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Issues        | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT

<!--
Replace this notice by a description of your feature/bugfix.
This will help reviewers and should be a good start for the documentation.

Additionally (see https://symfony.com/releases):
 - Always add tests and ensure they pass.
 - For new features, provide some code snippets to help understand usage.
 - Features and deprecations must be submitted against branch main.
 - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry
 - Never break backward compatibility (see https://symfony.com/bc).
-->

Taken from symfony/http-client@54118c6, because symfony/ux-google-map#1 and
#2340 (comment)

Commits
-------

89b735e Add PR template and auto-close PR on subtree split repositories
src/Map/doc/index.rst Outdated Show resolved Hide resolved
Copy link
Member

@Kocal Kocal left a comment

Choose a reason for hiding this comment

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

Please can you squash all of your commits and rebase on the latest 2.x?
Thanks

@carsonbot carsonbot added Status: Needs Work Additional work is needed and removed Status: Needs Review Needs to be reviewed labels Nov 22, 2024
@Kocal
Copy link
Member

Kocal commented Nov 22, 2024

With the merge of #2385 , there are now plenty of conflicts 😅
image

I'll take it from here :)

@Kocal Kocal force-pushed the feat/add-polylines branch from f07ce73 to 4015860 Compare November 22, 2024 23:39
@carsonbot carsonbot added Status: Needs Review Needs to be reviewed and removed Status: Needs Work Additional work is needed labels Nov 22, 2024
@Kocal Kocal force-pushed the feat/add-polylines branch from 4015860 to 754fd35 Compare November 22, 2024 23:43
@Kocal
Copy link
Member

Kocal commented Nov 22, 2024

PR squashed and rebased, I've added compatibility with UX Map inside a LiveComponent (I also fixed some things that I've forgot in #2385 😅), and applied some review comments.

@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Nov 22, 2024
Copy link
Member

@smnandre smnandre left a comment

Choose a reason for hiding this comment

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

Well, @sblondeau, what a nice first contribution here!

Thank you very much, and i cannot wait to see the next ones :)

@smnandre
Copy link
Member

Thanks for your work on this new feature!

@smnandre smnandre merged commit e95c0cd into symfony:2.x Nov 23, 2024
61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New Feature Map Status: Reviewed Has been reviewed by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants