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

Improve event social share widget #6289

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

GovernmentPlates
Copy link
Member

@GovernmentPlates GovernmentPlates commented Apr 11, 2024

This PR removes the legacy social share widget and replaces it with a more modern share widget (as well as adding in support for Mastodon).

TODO:

  • Support adding a Mastodon server URL via the share widget (if none has been set by the user)
  • Implement behaviour after setting Mastodon server URL (redirect w/ params) + hide away MN button for un-auth'd users
  • Cleanup
  • Changelog entry

Preview:
image

@bpedersen2
Copy link
Contributor

Two comments:

  1. It would be nice to make the shown social providers configurable (per site would be ok)
  2. minor: twitter did change its name and logo :(

@ThiefMaster
Copy link
Member

ThiefMaster commented Apr 12, 2024

It would be nice to make the shown social providers configurable (per site would be ok)

If any API credentials etc were needed I'd agree, but since that's not the case I'm not so sure... is there any good usecase why someone would want to show just some social share options? In the end users can just copy the link manually to any social media site anyway

minor: twitter did change its name and logo :(

I think considering what most people think and also your smiley reaction at the end, we have some good arguments to stick with the old one :P

indico/modules/users/blueprint.py Outdated Show resolved Hide resolved
indico/web/client/js/custom_elements/ind_share_widget.js Outdated Show resolved Hide resolved
indico/web/client/js/custom_elements/ind_share_widget.js Outdated Show resolved Hide resolved
indico/web/client/js/custom_elements/ind_share_widget.js Outdated Show resolved Hide resolved
indico/web/client/js/custom_elements/ind_share_widget.js Outdated Show resolved Hide resolved
indico/web/client/js/custom_elements/ind_share_widget.js Outdated Show resolved Hide resolved
indico/web/assets/vars_js.py Outdated Show resolved Hide resolved
indico/modules/users/controllers.py Outdated Show resolved Hide resolved
indico/modules/users/__init__.py Show resolved Hide resolved
indico/modules/users/forms.py Show resolved Hide resolved
indico/web/client/js/custom_elements/ind_share_widget.js Outdated Show resolved Hide resolved
indico/web/client/js/custom_elements/ind_share_widget.js Outdated Show resolved Hide resolved
indico/web/client/js/custom_elements/ind_share_widget.js Outdated Show resolved Hide resolved
Comment on lines 24 to 25
font-size: 1.4em !important;
margin: -2.8px 100px 8.5px !important;
Copy link
Member

Choose a reason for hiding this comment

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

Not a big fan of the hard-coded font sizes and margins. Would it be possible to use some existing SUI options/components to get the same look?

Copy link
Member Author

Choose a reason for hiding this comment

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

I did initially try to do some stuff with the existing SUI options/components, but I found that trying to center this large heading using the stuff in SUI didn't work inside the popup (hence why I have hardcoded the margin). As for the font-size; the available sizes in SUI just didn't really cut it for me, and made everything else look a bit weird...

But I will give this another try.

Copy link
Member Author

Choose a reason for hiding this comment

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

After playing around with this, I still cannot use SUI to do this (specifically the textAlign property). Although, doing this myself did lead to a somewhat similar outcome:

<div styleName="header-text">
   <Icon name="share alternate" styleName="icon" />
   <Translate as="strong">Share this page</Translate>
</div>
.header-text {
  font-size: 1.6em;
  text-align: center;
  margin: 5px 0 5px 0;

  .icon {
    margin-right: 5px;
  }
}

image

I'm not sure wether this might be an 'improvement' though... any thoughts?

@GovernmentPlates GovernmentPlates force-pushed the Mastodon-Sharer branch 4 times, most recently from 9b82730 to 73aee23 Compare May 31, 2024 13:35
GovernmentPlates and others added 3 commits May 31, 2024 17:18
This fixes an issue where using `window.open()` would trigger the pop-up blocker in FF (and other browsers except Chrome)
* Use custom URL validator in both popup and user settings page
* Ensure mastodon server URL is included when exporting data
* Tweak user_vars and popup
* Split `<SocialButton>` component into two seperate components (reduce
  complexity)
* Fix i18n issues in `<CalendarButtons>` component
* Attempt to fix-up hardcoded margins
* Add success message when the event link copied
indico/modules/users/util.py Show resolved Hide resolved
except requests.RequestException:
return None
try:
data = resp.json()
Copy link
Member

Choose a reason for hiding this comment

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

I think this may raise an error that's not handled if you get a successful response that's not valid JSON

Comment on lines 448 to 449
if url.scheme not in ('http', 'https'):
return False
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this should be moved into the validator(s)?

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.

None yet

4 participants