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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Chrome extension #3

Closed
1 of 2 tasks
bdougie opened this issue Dec 8, 2022 · 16 comments
Closed
1 of 2 tasks

Feature: Chrome extension #3

bdougie opened this issue Dec 8, 2022 · 16 comments

Comments

@bdougie
Copy link
Member

bdougie commented Dec 8, 2022

Type of feature

馃崟 Feature

Current behavior

We aren't getting submissions on the platform

Suggested solution

make an extension that suggests submissions for opensauced when user stars a repo.

Would love ideas on this approach.

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Contributing Docs

  • I agree to follow this project's Contribution Docs
@nickytonline
Copy link
Member

Some background about browser extensions

I've worked on a bunch of extensions including one for a previous job. If you're looking to hook into GitHub.com, I'd recommend taking a peek at the Refined GitHub browser extension. They integrate seamlessly with GitHub.

All the code you write for the extension will work in Chromium based browsers that support extensions, and Firefox basically took on the same API as the Chrome Extension API, so for the most part the extension will be cross-browser. The main difference is Chromium based browser use the version 3 of the manifest while last I checked, Firefox still only supports version 2 of the manifest, although they are working on v3 support.

I'd also recommend using Parcel as the bundler for the project if this goes ahead as they support reloading the extension during development with the manifest version 3.

Suggested Approach

The approach you probably want to take is to integrate directly into the GitHub user interface by adding a Hot Sauce button. You could probably also add an option to the extension that auto-suggests to opensauced when the user stars a repo.

To implement this, you could add a click event listener to the button or link that stars the repo. The click event listener would see if the user has auto-suggest to opensauced, and if it does, it'd make an API call to opensauced to auto-suggest the repo. You could get the repo URL to send most likely via window.location.href

If the option to auto-suggest isn't enabled, surface a button to auto-suggest a submission to open sauced.

Happy to discuss this further and even pair with folks.

@mtfoley
Copy link
Contributor

mtfoley commented Jan 9, 2023

Yo @nickytonline I wouldn't mind some pairing on this too if you're game!

I work on a couple of chrome extensions at work, and we moved a pretty old code base from MV2 to MV3.

LMK 馃殌

@0-vortex
Copy link

0-vortex commented Jan 9, 2023

馃憤

@nickytonline
Copy link
Member

I'm definitely game @mtfoley. @0-vortex @bdougie, would you be OK with @mtfoley and me whipping up a POC based on the suggested approach. We could start off with the Hot Sauce button. Also, welcome to suggestions for the approach.

@0-vortex
Copy link

I'm definitely game @mtfoley. @0-vortex @bdougie, would you be OK with @mtfoley and me whipping up a POC based on the suggested approach. We could start off with the Hot Sauce button.

I'm all up for it, electron comes with some quirks, and can help with tooling. We should be able to use the current release system, however, nothing is set in stone. To not complicate things, you can work on the profile repo and duplicate it or transfer it to open-sauced when it's ready to be tooled.

Also, welcome to suggestions for the approach.

Tech wise, best way to handle things is to use the public api and treat the chrome extension as a normal client. For anything that's not available, open an issue and we can figure out options! 馃崟

@mtfoley
Copy link
Contributor

mtfoley commented Jan 12, 2023

We are going to work inside of https://github.com/open-sauced/browser-extensions

@mtfoley mtfoley mentioned this issue Jan 12, 2023
2 tasks
@mtfoley mtfoley transferred this issue from open-sauced/hot Jan 17, 2023
@mtfoley
Copy link
Contributor

mtfoley commented Jan 18, 2023

Dropping this Supabase discussion here in case we can use it:
supabase/supabase#5787
cc @0-vortex @nickytonline

@0-vortex
Copy link

Dropping this Supabase discussion here in case we can use it:
supabase/supabase#5787
cc @0-vortex @nickytonline

Those discussions treat everything as a client, which is fine, but would focus more on understanding the OAuth flow, what SupaBase does and how it integrates with the natural way of using GitHub OAuth apps.

TL;DR: use a PAT for now, replace the PAT later with some seamless technique, but I doubt it's the one mentioned above ... :<

@nickytonline
Copy link
Member

Yeah I was thinking a personal access token (PAT) as well for starters at least which the user would set in the extension settings.

@bdougie
Copy link
Member Author

bdougie commented Jan 25, 2023

Sorry for the delay on this. Here is my pitch for a POC. Instead of looking at repos, could we make the POC github profiles and identify if they are an OpenSauced users. If they are we should add details on contributed PRs.

Maybe even an invite to opensauced or view on opensauced.

example from opensauced: https://insights.opensauced.pizza/user/eltocier

Screen Shot 2023-01-19 at 2 19 00 PM

cc/ @mtfoley

@bdougie
Copy link
Member Author

bdougie commented Jan 27, 2023

Here is an easier option. Let's add a pizza to the profile if they have an opensauced account. Polywork already does this.

https://opensauced.pizza/press to fetch the pizze

https://chrome.google.com/webstore/detail/polywork-for-twitter/cbomeonlbafdkljihnmhkgkjojmenmci

"OpenSauced for GitHub"

Screen Shot 2023-01-27 at 10 33 00 AM

@nickytonline
Copy link
Member

One thing to note about adding it is GitHub has a status drop down in that spot. We'd need to figure out where to best place the OpenSauced button.

CleanShot 2023-01-27 at 17 05 54

CleanShot 2023-01-27 at 17 09 40

For the button, make it an actual button (Polywork uses a <div />. The reason being is you will get all the accessibility of a button out of the box, i.e. keyboard navigation.

If we get the Avatar container, we can then place the button inside it relative to the container, i.e. document.querySelector('[aria-label="Change your avatar"]').parentElement. The container has position: relative, so then you can set the OpenSauced button via position: absolute relative to the container, pretty much like the status button does it.

@bdougie
Copy link
Member Author

bdougie commented Mar 5, 2023

I spoke with @nickytonline about this already, but a heads up. GitHub is once again provided OpenSauced interns through the Octernships program.

My plan is to keep this single intern focused on this problem, setting up the initial browser extension. I have created a new org (open-sauced-craftwork) for 500+ student applicants to try building the basics extension. I will give everyone here access to review, if you'd like but no pressure if you don't have the time.

Also the repo is private so it can connect directly with GitHub Classroom.

This is the assignment. A button should show if the GitHub user is signed up for OpenSauced. Pretty basic, but just the start.

Screen Shot 2023-03-04 at 2 27 39 PM

@bdougie

This comment was marked as outdated.

@takanome-dev
Copy link

Awesome 馃崟

Some ideas that came to my mind after viewing open-sauced-craftwork/browser-extension#5

  • display the user avatar and name after login
  • the number of highlights created
  • the number of opened/closed prs on opensauced (or github maybe...)

A summary of the user's insights profile 馃崟

@bdougie
Copy link
Member Author

bdougie commented Apr 24, 2023

This project is live and underway. Submission to the chrome store has been made too.

Closing this and moving context to the project board. https://github.com/orgs/open-sauced/projects/10

@bdougie bdougie closed this as completed Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants