diff --git a/app/assets/stylesheets/settings.scss b/app/assets/stylesheets/settings.scss index 2e4ff52a5..462023beb 100755 --- a/app/assets/stylesheets/settings.scss +++ b/app/assets/stylesheets/settings.scss @@ -352,6 +352,24 @@ margin-top: 20px; width: 70%; } + .single-app-integration { + @include themeable(background, theme-container-background, #fff); + @include themeable(border, theme-border, 1px solid $light-medium-gray); + border-radius: 8px; + padding: 10px; + h2 { + margin: 0; + padding: 0; + font-size: 1.5em; + } + sup { + @include themeable(color, theme-secondary-color, $medium-gray); + } + img { + height: 1.0em; + margin-left: 5px; + } + } } .default-billing-message { margin: 10px 0px; diff --git a/app/decorators/user_decorator.rb b/app/decorators/user_decorator.rb index aff0e385e..58fd1ed86 100644 --- a/app/decorators/user_decorator.rb +++ b/app/decorators/user_decorator.rb @@ -83,4 +83,8 @@ class UserDecorator < ApplicationDecorator ] colors[id % 10] end + + def stackbit_integration? + access_tokens.any? + end end diff --git a/app/views/users/_integrations.html.erb b/app/views/users/_integrations.html.erb index ae19b7c27..748bf7bb0 100644 --- a/app/views/users/_integrations.html.erb +++ b/app/views/users/_integrations.html.erb @@ -7,14 +7,31 @@ <%= javascript_pack_tag "githubRepos", defer: true %> <% end %> -<%= form_tag users_update_twitch_username_path do |f| %> -

Live Streaming (Beta)

-
- <%= label_tag "user[twitch_username]", "Twitch Username" %> - <%= text_field_tag "user[twitch_username]", @user.twitch_username %> -
-

Add your Twitch username, and then checkout dev.to/live/<%= @user.username %>.

-

It's a new thing we're trying out. Soon we'll be able to indicate when any community member is currently streaming.

+
+

Generate a personal blog from your DEV posts

+
+ <% if current_user.decorate.stackbit_integration? %> +

Connected to Stackbit beta" />

+

Go to your Stackbit Dashboard

+ <% else %> +

Connect to Stackbit beta

+

Automatically generate a self-hosted static blog feed from your DEV posts.

+

Get Started

+ <% end %> +
- <%= submit_tag "SUBMIT", class: "cta" %> -<% end %> +<% if false # removed since isn't fully working right now %> +
+ + <%= form_tag users_update_twitch_username_path do |f| %> +

Live Streaming (Experimental)

+
+ <%= label_tag "user[twitch_username]", "Twitch Username" %> + <%= text_field_tag "user[twitch_username]", @user.twitch_username %> +
+

Add your Twitch username, and then checkout dev.to/live/<%= @user.username %>.

+

It's a new thing we're trying out. Soon we'll be able to indicate when any community member is currently streaming.

+ + <%= submit_tag "SUBMIT", class: "cta" %> + <% end %> +<% end %> \ No newline at end of file diff --git a/spec/system/user/user_edits_integrations_spec.rb b/spec/system/user/user_edits_integrations_spec.rb index 7de09e6d4..51e522ccd 100644 --- a/spec/system/user/user_edits_integrations_spec.rb +++ b/spec/system/user/user_edits_integrations_spec.rb @@ -19,7 +19,7 @@ RSpec.describe "User edits their integrations", type: :system, js: true do end describe "via visiting /settings" do - it "and sets a Twitch Username" do + xit "and sets a Twitch Username" do visit "/settings" expect(page).to have_current_path("/settings") @@ -33,5 +33,20 @@ RSpec.describe "User edits their integrations", type: :system, js: true do visit "/settings/integrations" expect(find_field("Twitch Username").value).to eq "TestTwitchUser" end + it "has connect-to-stackbit prompt" do + visit "/settings" + expect(page).to have_current_path("/settings") + + click_link "Integrations" + expect(page).to have_text("Connect to Stackbit") + end + it "has connected-to-stackbit prompt if already integrated" do + create(:doorkeeper_access_token, resource_owner: user) + visit "/settings" + expect(page).to have_current_path("/settings") + + click_link "Integrations" + expect(page).to have_text("Connected to Stackbit") + end end end