From 4de066e5056bb6bb535553ddc35188c2d640ef93 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Tue, 29 Dec 2020 19:02:08 -0600 Subject: [PATCH] done --- db/up/find_sessions_2020.sql | 2 +- ruby/lib/jam_ruby/models/user.rb | 5 + ruby/lib/jam_ruby/subscription_definitions.rb | 6 +- web/.ruby-version | 2 +- .../landing/HomePage.js.jsx.coffee | 2 +- web/app/assets/javascripts/react-init.js | 1 + .../javascripts/support/react-components.js | 1 + .../react-components/SupportPage.js.jsx | 46 +++++ web/app/assets/javascripts/support/support.js | 7 + .../assets/stylesheets/support/constants.scss | 19 ++ .../support/react-components/SupportPage.scss | 172 ++++++++++++++++++ .../assets/stylesheets/support/support.scss | 68 +++++++ web/app/controllers/supports_controller.rb | 19 ++ web/app/views/clients/_footer.html.erb | 2 +- web/app/views/corps/help.html.erb | 2 +- web/app/views/layouts/events.html.erb | 2 +- web/app/views/layouts/support.html.erb | 45 +++++ web/app/views/supports/show.slim | 6 + web/app/views/users/_user_dropdown.html.erb | 4 +- web/config/application.rb | 1 + web/config/routes.rb | 1 + .../lib/jam_websockets/router.rb | 1 - 22 files changed, 404 insertions(+), 10 deletions(-) create mode 100644 web/app/assets/javascripts/support/react-components.js create mode 100644 web/app/assets/javascripts/support/react-components/SupportPage.js.jsx create mode 100644 web/app/assets/javascripts/support/support.js create mode 100644 web/app/assets/stylesheets/support/constants.scss create mode 100644 web/app/assets/stylesheets/support/react-components/SupportPage.scss create mode 100644 web/app/assets/stylesheets/support/support.scss create mode 100644 web/app/controllers/supports_controller.rb create mode 100644 web/app/views/layouts/support.html.erb create mode 100644 web/app/views/supports/show.slim diff --git a/db/up/find_sessions_2020.sql b/db/up/find_sessions_2020.sql index 3458f1573..2166d31aa 100644 --- a/db/up/find_sessions_2020.sql +++ b/db/up/find_sessions_2020.sql @@ -155,4 +155,4 @@ CREATE INDEX mixes_recording_id_idx ON mixes USING btree (recording_id); CREATE INDEX msuh_id_idx ON music_sessions_user_history USING btree (id); CREATE INDEX quick_mixes_user_id_idx ON quick_mixes USING btree (user_id); CREATE INDEX recorded_videos_user_id_idx ON recorded_videos USING btree (user_id); -CREATE INDEX CONCURRENTLY music_sessions_user_id_idx ON music_sessions USING btree (user_id); +CREATE INDEX music_sessions_user_id_idx ON music_sessions USING btree (user_id); diff --git a/ruby/lib/jam_ruby/models/user.rb b/ruby/lib/jam_ruby/models/user.rb index 7010e5927..ce812a198 100644 --- a/ruby/lib/jam_ruby/models/user.rb +++ b/ruby/lib/jam_ruby/models/user.rb @@ -2862,6 +2862,11 @@ module JamRuby end end + def has_support? + return false if !subscription_trial_ended? + return true if admin + SubscriptionDefinitions.rules(self.subscription_plan_code)[:has_support] + end def subscription_rules(dynamic_definitions = true) rules = SubscriptionDefinitions.rules(self.subscription_plan_code) diff --git a/ruby/lib/jam_ruby/subscription_definitions.rb b/ruby/lib/jam_ruby/subscription_definitions.rb index 7683d3706..69c55c151 100644 --- a/ruby/lib/jam_ruby/subscription_definitions.rb +++ b/ruby/lib/jam_ruby/subscription_definitions.rb @@ -37,6 +37,7 @@ module JamRuby broadcasting_type: 3, max_players: 4, pro_audio: false, + has_support: false, name: 'Free' } @@ -52,8 +53,9 @@ module JamRuby audio_max_bitrate: 2, #192 can_broadcast: true, broadcasting_type: 3, - max_players: 6, + max_players: nil, pro_audio: false, + has_support: false, name: 'Silver' } @@ -70,6 +72,7 @@ module JamRuby broadcasting_type: 3, max_players: nil, pro_audio: true, + has_support: true, name: 'Gold' } @@ -86,6 +89,7 @@ module JamRuby broadcasting_type: 3, max_players: nil, pro_audio: true, + has_support: true, name: 'Platinum' } diff --git a/web/.ruby-version b/web/.ruby-version index cb506813e..2bf1c1ccf 100644 --- a/web/.ruby-version +++ b/web/.ruby-version @@ -1 +1 @@ -2.0.0-p247 +2.3.1 diff --git a/web/app/assets/javascripts/react-components/landing/HomePage.js.jsx.coffee b/web/app/assets/javascripts/react-components/landing/HomePage.js.jsx.coffee index feafcd47e..184a1da59 100644 --- a/web/app/assets/javascripts/react-components/landing/HomePage.js.jsx.coffee +++ b/web/app/assets/javascripts/react-components/landing/HomePage.js.jsx.coffee @@ -375,7 +375,7 @@ context = window rel="external">privacy  |  terms of service  |  help + href="/help_desk" rel="external">help diff --git a/web/app/assets/javascripts/react-init.js b/web/app/assets/javascripts/react-init.js index e6571c691..2d4df4a51 100644 --- a/web/app/assets/javascripts/react-init.js +++ b/web/app/assets/javascripts/react-init.js @@ -1,3 +1,4 @@ +window.JK = window.JK || {}; window.JK.Actions = {} window.JK.Stores = {} window.JK.Components = {} \ No newline at end of file diff --git a/web/app/assets/javascripts/support/react-components.js b/web/app/assets/javascripts/support/react-components.js new file mode 100644 index 000000000..51023ee33 --- /dev/null +++ b/web/app/assets/javascripts/support/react-components.js @@ -0,0 +1 @@ +//= require_directory ./react-components diff --git a/web/app/assets/javascripts/support/react-components/SupportPage.js.jsx b/web/app/assets/javascripts/support/react-components/SupportPage.js.jsx new file mode 100644 index 000000000..70554e015 --- /dev/null +++ b/web/app/assets/javascripts/support/react-components/SupportPage.js.jsx @@ -0,0 +1,46 @@ +window.SupportPage = React.createClass({ + + render: function () { + + + var support_space = null; + var support_warning = null; + + if(gon.has_support) { + var src = `https://jamkazam.freshdesk.com/widgets/feedback_widget/new?&helpdesk_ticket[requester]=${encodeURIComponent(gon.email)}&widgetType=embedded&formTitle=JamKazam+Support&submitTitle=Send+Feedback&submitThanks=Thank+you+for+your+message.+We+will+use+our+best+efforts+to+reply+within+24+hours.` + + support_space =
+ } + else { + if(gon.in_trial) { + support_space=
The functionality on this page is disabled because you are currently in the free trial period and are not eligible for support.

You can change your plan here.
+ } + else { + support_space=
The functionality on this page is disabled because you must have a Platinum or Gold plan to use support.

You can change your plan here.
+ } + } + + var response =
+ +
+ {support_warning} +
+ The JamKazam help desk offers 1:1 help desk support only to our Gold and Platinum plan + subscribers. More information on subscription plans can be found here.

If you are not a Gold or Platinum subscriber, + we'd suggest that you look for help in our extensive knowledge base of + help articles, + or check out our user forum to see if + other JamKazam users can help you. +
+ + {support_space} + +
+
+ return response + } +}) \ No newline at end of file diff --git a/web/app/assets/javascripts/support/support.js b/web/app/assets/javascripts/support/support.js new file mode 100644 index 000000000..540ece689 --- /dev/null +++ b/web/app/assets/javascripts/support/support.js @@ -0,0 +1,7 @@ +//= require reflux +//= require react +//= require react_ujs +//= require react-init +//= require react-input-autosize +//= require react-select +//= require ./react-components diff --git a/web/app/assets/stylesheets/support/constants.scss b/web/app/assets/stylesheets/support/constants.scss new file mode 100644 index 000000000..1d781463a --- /dev/null +++ b/web/app/assets/stylesheets/support/constants.scss @@ -0,0 +1,19 @@ + +$base-font-family: 'arial', sans-serif; + +$large-font-size: 1.5rem; +$standard-font-size: 1rem; +$smaller-font-size: .8rem; +$small-font-size: .7rem; +$input-font-size: 1.0rem; +$submit-button-width:9rem; +$checkbox-label-width:14rem; +$create-account-width:10rem; +$start-promo-btn-width:13rem; +$jamkazam-background:#323232; +$jamkazam-background2:#2c2c2c; + +$copy-color-on-dark: #b9b9b9; +$copy-color-on-white: #575757; +$cta-color: #e03d04; +$chunkyBorderWidth: 6px; diff --git a/web/app/assets/stylesheets/support/react-components/SupportPage.scss b/web/app/assets/stylesheets/support/react-components/SupportPage.scss new file mode 100644 index 000000000..71adfb078 --- /dev/null +++ b/web/app/assets/stylesheets/support/react-components/SupportPage.scss @@ -0,0 +1,172 @@ +@import "support/constants"; +@import "client/common.scss"; + +[data-react-class="SupportPage"] { + width:100%; + + .EventsPage { + width:100%; + } + + #header { + display:grid; + justify-content: center; + width:100%; + background-color:$jamkazam-background2; + padding:1.5rem 0; + } + + #root { + min-height: 100%; + + align-items: center; + //justify-content: center; + min-width: 50%; + display: flex; + flex-direction: column; + } + + + .logo-holder { + background: url('/assets/logo.png') no-repeat; + height: 47px; + width: 252px; + color:white; + } + + .title { + font-size: 2rem; + } + + .description { + font-size: 1rem; + margin-top: .2rem; + width:1000px; + margin-bottom:2rem; + color:$copy-color-on-white; + a { + color:darken(#fc0, 20%); + white-space:nowrap; + } + line-height:150%; + } + + iframe { + background-color:white; + } + + .buffer { + background-color:white; + padding:1rem; + } + + .support-warning { + background-color:lightgrey; + font-weight:bold; + font-size: 1rem; + margin-top: 1rem; + width:1000px; + margin-bottom:2.5rem; + padding:1rem; + color:$copy-color-on-white; + a { + color:darken(#fc0, 20%); + white-space:nowrap; + } + line-height:150%; + } + + #powered-by, #powered-by-2 { + text-align: center; + vertical-align: middle; + position: absolute; + top: -3rem; + margin: auto; + width: 100%; + display: grid; + align-items: center; + justify-content: center; + + span { + font-size: .8rem; + text-align: left; + } + } + + .powered-by { + background: url("/assets/shared/jk_logo_small.png") no-repeat center; + height: 26px; + width: 142px; + } + + #powered-by-2 { + display: none; + } + + + #body-content { + background-color:black; + display:grid; + grid-template-columns: 60% 2% 38%; + justify-content:center; + margin-bottom:6rem; + padding:0 1rem; + } + + #top-container { + background-color:white; + display: grid; + justify-content:center; + padding:2rem 0 7rem 0; + grid-template-columns: min-content; + } + + + .logo-holder { + max-width: 300px; + min-width:0; + img { + width: 100%; + } + position:relative; + } + + #help-desk { + position:absolute; + bottom: -25px; + left: 134px; + font-size:1.5rem; + } + + + div.root { + flex-grow: 1; + overflow: auto; + } + + .header { + font-size: $large-font-size; + margin-top: 1rem; + min-width: 1000px; + text-align: center; + } + + html { + font-size: 100%; + } + + @media (min-width:1px) and (max-width: 1199px) { + html { + font-size: 100%; + } + + .header { + min-width:90%; + padding-left:1.5rem; + } + .description { + width:90%; + padding-left:1.5rem; + } + } +} \ No newline at end of file diff --git a/web/app/assets/stylesheets/support/support.scss b/web/app/assets/stylesheets/support/support.scss new file mode 100644 index 000000000..2f6156ebc --- /dev/null +++ b/web/app/assets/stylesheets/support/support.scss @@ -0,0 +1,68 @@ +/** + +*= require_directory ./react-components +*/ + +@import "support/constants"; + +html, +body { + min-height: 100%; + overflow:auto; + //background-color:$jamkazam-background; + background-color:white; + color:white; +} + +body { + min-height: 100%; + margin: 0; + padding: 0; + + font-size: 16px; + line-height: 1.2; + font-family: Raleway, Arial, Helvetica, sans-serif; + +} + +#footer { + display:inline-block; + margin-top: 30px; + padding-top: 10px; + border-top:solid 1px #444; + position: fixed; + left: 0; + bottom: 0; + width: 100%; + color: white; + text-align: center; + background-color:#323232; +} + +#copyright { + float:left; + font-size:11px; + color:#ccc; +} + +#footer-links { + float:right; + font-size:11px; + color:#ccc; +} + +#footer-links a { + color:#ccc; + text-decoration:none; +} + +#footer-links a:hover { + color:#fff; + text-decoration:underline; +} + +#version { + font-size:11px; + color:#ccc; + text-align: center; +} \ No newline at end of file diff --git a/web/app/controllers/supports_controller.rb b/web/app/controllers/supports_controller.rb new file mode 100644 index 000000000..d1e83eed5 --- /dev/null +++ b/web/app/controllers/supports_controller.rb @@ -0,0 +1,19 @@ +class SupportsController < ApplicationController + + respond_to :html + def show + if current_user.nil? + redirect_to signin_url + "?redirect-to=" + URI.escape("/help_desk"), notice: "Please sign in." + return + end + gon.has_support = current_user.has_support? + gon.email = current_user.email + gon.in_trial = !current_user.subscription_trial_ended? + + @title = "Help Desk" + @description = "The JamKazam help desk offers 1:1 help desk support only to our Gold and Platinum plan subscribers." + render 'show', :layout => 'support' + end + + +end \ No newline at end of file diff --git a/web/app/views/clients/_footer.html.erb b/web/app/views/clients/_footer.html.erb index cfc63719f..4d8f793bf 100644 --- a/web/app/views/clients/_footer.html.erb +++ b/web/app/views/clients/_footer.html.erb @@ -5,7 +5,7 @@ <%= render "clients/recordingManager" %> diff --git a/web/app/views/corps/help.html.erb b/web/app/views/corps/help.html.erb index e114800ad..e0467655e 100644 --- a/web/app/views/corps/help.html.erb +++ b/web/app/views/corps/help.html.erb @@ -9,5 +9,5 @@ Desk.com service using your JamKazam credentials, so you won't have to register for a separate support account.

-JamKazam Support +JamKazam Support

\ No newline at end of file diff --git a/web/app/views/layouts/events.html.erb b/web/app/views/layouts/events.html.erb index dc725c8bd..9f9ba6fb1 100644 --- a/web/app/views/layouts/events.html.erb +++ b/web/app/views/layouts/events.html.erb @@ -32,7 +32,7 @@ - + diff --git a/web/app/views/layouts/support.html.erb b/web/app/views/layouts/support.html.erb new file mode 100644 index 000000000..9e5fc06e4 --- /dev/null +++ b/web/app/views/layouts/support.html.erb @@ -0,0 +1,45 @@ + + + + <%= full_title(yield(:title)) %> + + + + + + + <%= stylesheet_link_tag "support/support", media: "all" %> + <%= include_gon(:init => true) %> + <%= csrf_meta_tags %> + + + <% if content_for?(:social_meta) %> + <%= yield(:social_meta) %> + <% else %> + <%= render "layouts/social_meta" %> + <% end %> + <%= render "shared/ad_sense" %> + + +
+ <%= javascript_include_tag "support/support" %> +
+ <%= yield %> + +
+
+<%= render "shared/ga" %> + + \ No newline at end of file diff --git a/web/app/views/supports/show.slim b/web/app/views/supports/show.slim new file mode 100644 index 000000000..e4a062443 --- /dev/null +++ b/web/app/views/supports/show.slim @@ -0,0 +1,6 @@ +- provide(:page_name, 'Open Support Ticket') +- provide(:description, @description) +- provide(:title, @title) + +#root + = react_component 'SupportPage' diff --git a/web/app/views/users/_user_dropdown.html.erb b/web/app/views/users/_user_dropdown.html.erb index 11f3935fc..ceb2db447 100644 --- a/web/app/views/users/_user_dropdown.html.erb +++ b/web/app/views/users/_user_dropdown.html.erb @@ -64,11 +64,11 @@ <% if false #@nativeClient %>
  • <%= link_to "Test Network", '#' %>
  • <% end %> -
  • <%= link_to "Get Help", 'https://forum.jamkazam.com/', :rel => "external" %>
  • +
  • <%= link_to "Get Help", help_desk_path, :rel => "external" %>
  • <%= link_to "Sign Out", signout_path, method: "delete" %>
  • <% else %>
  • <%= link_to "Download App", downloads_path, :rel => "external" %>
  • -
  • <%= link_to "Get Help", 'https://forum.jamkazam.com/', :rel => "external" %>
  • +
  • <%= link_to "Get Help", help_desk_path, :rel => "external" %>
  • <% end %> diff --git a/web/config/application.rb b/web/config/application.rb index d4192b449..aa579228a 100644 --- a/web/config/application.rb +++ b/web/config/application.rb @@ -91,6 +91,7 @@ if defined?(Bundler) config.assets.precompile += %w( modern/modern.js modern/modern.css ) config.assets.precompile += %w( basic/basic.js basic/basic.css ) config.assets.precompile += %w( events/events.js events/events.scss ) + config.assets.precompile += %w( support/support.js support/support.scss ) # where is rabbitmq? config.rabbitmq_host = "127.0.0.1" diff --git a/web/config/routes.rb b/web/config/routes.rb index 63f2c52fc..eb0e323ab 100644 --- a/web/config/routes.rb +++ b/web/config/routes.rb @@ -141,6 +141,7 @@ Rails.application.routes.draw do get '/events/:slug', to: 'events#show', :as => 'event' get '/events', to: 'events#list', as: 'events' + get '/help_desk', to:'supports#show', as: 'help_desk' get '/endorse/:id/:service', to: 'users#endorse', :as => 'endorse' diff --git a/websocket-gateway/lib/jam_websockets/router.rb b/websocket-gateway/lib/jam_websockets/router.rb index 635ea6313..5fb2865b6 100644 --- a/websocket-gateway/lib/jam_websockets/router.rb +++ b/websocket-gateway/lib/jam_websockets/router.rb @@ -1505,7 +1505,6 @@ module JamWebsockets # #end - puts "periodical_check_connections" @client_lookup.each do |client_id, client_context| if Time.now - client_context.updated_at > @connect_time_expire_client cleanup_client_with_id(client_id)