Skip to content

Improve first-install flow to facilitate token input (first Svelte usage) - #7854

Merged
fregante merged 27 commits into
mainfrom
welcome
Oct 11, 2024
Merged

fregante merged 27 commits into
mainfrom
welcome

Conversation

@fregante

@fregante fregante commented Oct 4, 2024 •

Copy link
Copy Markdown
Member

I think people install the extension and don't realize that it asks for a token. This is somewhat understandable, at least until they open the options page (if ever) or look at the console. More likely they will just complain that the UI doesn't work the way they expect it to.

A second issue is that in Safari they will be shown the Welcome Page but Refined GitHub is not loaded yet because Safari does not automatically grant access on install. This UI merges both needs into one step.

Safari

safari.mov

Chrome + error demo

Screen.Recording.3.mov

Safari iOS

iOS.mov

@fregante fregante added the meta Related to Refined GitHub itself label Oct 4, 2024
Comment thread rollup.config.js
import del from 'rollup-plugin-delete';
import webpackStatsPlugin from 'rollup-plugin-webpack-stats';
import svelte from 'rollup-plugin-svelte';
import {sveltePreprocess} from 'svelte-preprocess';

@fregante fregante Oct 4, 2024 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The cool part is that this PR finally adds support for proper dynamic components that can even be used via our native-DOM JSX solution. This will eventually help features on React views, for example:

Related:

Comment thread rollup.config.js
}),
svelte({
compilerOptions: {
customElement: true,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Svelte is probably the best solution here:

  • no JSX conflicts
  • dedicated .svelte file that can live next to the .tsx file as <feature-name>.svelte
  • custom elements support, so these components can be used in JSX as <rgh-something count={1}/>

Comment thread source/background.ts
if (await isFirstInstall(reason)) {
await chrome.tabs.create({
url: 'https://github.com/refined-github/refined-github/issues/3543',
url: chrome.runtime.getURL('assets/welcome.html'),

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The old "welcome page" is now shown as a second step.

@@ -0,0 +1,34 @@
/* You can have invisible/inactive links to the options page on the wiki. This feature enables them. */

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Two changes:

  • it now applies to the entire wiki, and maybe the entire repo in the future

  • it simplifies the markup while remaining invisible without extension

    - [](#rgh-linkify-welcome-issue)extension’s options[](#rgh-linkify-welcome-issue)
    + <a name="options-page-link">extension’s options</a>

Comment thread source/options.css Resolved
Comment thread source/options.html Resolved
Comment thread source/welcome.css
margin-right: 0.3em;
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" fill="gray" d="M8 5.5a2.5 2.5 0 100 5 2.5 2.5 0 000-5zM4 8a4 4 0 118 0 4 4 0 01-8 0z"></path></svg>');
background-size: contain;
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Styles come from the options page. Eventually I might componentize this.

Comment thread source/welcome.svelte
@@ -0,0 +1,126 @@
<svelte:options customElement='rgh-welcome' />

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This file is a bit messy. Suggestions on how to make it more "svelte-like" very much welcome.

Comment thread source/welcome.svelte
<svelte:options customElement='rgh-welcome' />

<script lang='ts'>
import './welcome.css';

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

One thing I skipped (for now?) is the use of <style> tags because I can't format the CSS in it without also formatting the JS:

JS formatting is taken care of by eslint.

Maybe one day with:

@fregante
fregante requested review from kidonng and yakov116 October 4, 2024 12:19
@yakov116

yakov116 commented Oct 7, 2024

Copy link
Copy Markdown
Member

Looks awesome!!

I would love to test it, I will ty it later and get back to you.

Comment thread source/background.ts Resolved
@fregante

Copy link
Copy Markdown
Member Author

Match GitHub style

chrome-extension___jialghbnladbdlhaibaoejjlnihkmemc_assets_welcome html (1)
chrome-extension___jialghbnladbdlhaibaoejjlnihkmemc_assets_welcome html (2)
chrome-extension___jialghbnladbdlhaibaoejjlnihkmemc_assets_welcome html(iPhone SE) (1)

@fregante
fregante enabled auto-merge (squash) October 11, 2024 19:32
@fregante
fregante merged commit f3d0680 into main Oct 11, 2024
@fregante
fregante deleted the welcome branch October 11, 2024 19:33
@djhoese

djhoese commented Oct 15, 2024

Copy link
Copy Markdown

Maybe I missed something but I couldn't find information on this welcome/token page nor the "More info"-linked Wiki page about what permissions the token needs.

Comment thread source/welcome.svelte
<!-- svelte-ignore a11y-click-events-have-key-events -->
<li class:valid={stepValid >= 2} class:visible={stepVisible >= 2} class='will-show' on:click={showThirdStep}>
<a
href='https://github.com/settings/tokens/new?description=Refined%20GitHub&scopes=repo,read:project'

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@djhoese thanks for the comment!

The link should already pre-select the minimal scopes we expect, see the link here. Does it not happen for you? What's your browser? This is what you should see:

IMG_6045

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Ah, that would do it. I didn't click that link. I went to the token page myself. Makes sense.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'll see if I can add that information in the wiki as well though, and/or I'll bring out the same UI we have in the options page.

@fregante fregante changed the title Improve first-install flow to facilitate token input Improve first-install flow to facilitate token input (first Svelte usage) Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

meta Related to Refined GitHub itself

Development

Successfully merging this pull request may close these issues.

3 participants