Skip to content

Commit 316d356

Browse files
authored
Add centralized help and support messaging system (#1803)
1 parent 7ee9e11 commit 316d356

File tree

6 files changed

+61
-17
lines changed

6 files changed

+61
-17
lines changed

README.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,16 +140,21 @@ _Requires creating a free account._
140140
- Node.js >= 20 (CI tested: 20 - 22)
141141
- A JavaScript package manager (npm, yarn, pnpm, or bun)
142142

143-
# Support
143+
# 🆘 Get Help & Support
144144

145-
- [Click to join **React + Rails Slack**](https://join.slack.com/t/reactrails/shared_invite/zt-38oicm9d0-OO0V~bdg4aYNuZuUbRFSXg).
145+
**Need immediate help?** Here are your options, ordered by response time:
146146

147-
- [**Subscribe**](https://app.mailerlite.com/webforms/landing/l1d9x5) for announcements of new releases of React on Rails and of our latest [blog articles](https://blog.shakacode.com) and tutorials.
148-
- [Discussions](https://github.com/shakacode/react_on_rails/discussions): Post your questions regarding React on Rails
149-
- **[forum.shakacode.com](https://forum.shakacode.com)**: Other discussions
150-
- **[@railsonmaui on Twitter](https://twitter.com/railsonmaui)**
151-
- _See [NEWS.md](https://github.com/shakacode/react_on_rails/tree/master/NEWS.md) for more notes over time._
152-
- See [Projects](https://github.com/shakacode/react_on_rails/tree/master/PROJECTS.md) using and [KUDOS](https://github.com/shakacode/react_on_rails/tree/master/KUDOS.md) for React on Rails. Please submit yours! Please edit either page or [email us](mailto:contact@shakacode.com) and we'll add your info. We also **love stars** as it helps us attract new users and contributors.
147+
- 🚀 **Professional Support**: [react_on_rails@shakacode.com](mailto:react_on_rails@shakacode.com) - Fastest resolution for bugs, upgrades, and consulting
148+
- 💬 **React + Rails Slack**: [Join our community](https://invite.reactrails.com) - Chat with other developers
149+
- 🆓 **GitHub Issues**: [Report bugs](https://github.com/shakacode/react_on_rails/issues) - Community support
150+
- 📖 **Discussions**: [Ask questions](https://github.com/shakacode/react_on_rails/discussions) - General help
151+
152+
**Additional Resources:**
153+
154+
- [**Subscribe**](https://app.mailerlite.com/webforms/landing/l1d9x5) for announcements of new releases and tutorials
155+
- **[forum.shakacode.com](https://forum.shakacode.com)** - Development discussions
156+
- **[@railsonmaui on Twitter](https://twitter.com/railsonmaui)** - Updates and tips
157+
- [Projects using React on Rails](https://github.com/shakacode/react_on_rails/tree/master/PROJECTS.md) - Submit yours!
153158

154159
## Contributing
155160

@@ -163,6 +168,8 @@ ShakaCode is **[hiring passionate software engineers](http://www.shakacode.com/c
163168

164169
The gem is available as open source under the terms of the [MIT License](https://github.com/shakacode/react_on_rails/tree/master/LICENSE.md).
165170

171+
Note, some features are available only with a React on Rails Pro subscription. See [React on Rails Pro](https://www.shakacode.com/react-on-rails-pro/) for more information.
172+
166173
# Supporters
167174

168175
The following companies support our open-source projects, and ShakaCode uses their products!

lib/react_on_rails/json_parse_error.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ class JsonParseError < ::ReactOnRails::Error
77
def initialize(parse_error:, json:)
88
@json = json
99
@original_error = parse_error
10-
super(parse_error.message)
10+
message = <<~MSG
11+
#{parse_error.message}
12+
13+
#{Utils.default_troubleshooting_section}
14+
MSG
15+
super(message)
1116
end
1217

1318
def to_honeybadger_context

lib/react_on_rails/prerender_error.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ def calc_message(component_name, console_messages, err, js_code, props)
8383
MSG
8484

8585
end
86+
87+
# Add help and support information
88+
message << "\n#{Utils.default_troubleshooting_section}\n"
89+
8690
[backtrace, message]
8791
end
8892
end

lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def exec_server_render_js(js_code, render_options, js_evaluator = nil)
7777
if err.message.include?("ReferenceError: self is not defined")
7878
msg << "\nError indicates that you may have code-splitting incorrectly enabled.\n"
7979
end
80+
msg << "\n#{Utils.default_troubleshooting_section}\n"
8081
raise ReactOnRails::Error, msg, err.backtrace
8182
end
8283

@@ -122,7 +123,7 @@ def read_bundle_js_code
122123
rescue StandardError => e
123124
msg = "You specified server rendering JS file: #{server_js_file}, but it cannot be " \
124125
"read. You may set the server_bundle_js_file in your configuration to be \"\" to " \
125-
"avoid this warning.\nError is: #{e}"
126+
"avoid this warning.\nError is: #{e}\n\n#{Utils.default_troubleshooting_section}"
126127
raise ReactOnRails::Error, msg
127128
end
128129

@@ -149,7 +150,8 @@ def create_js_context
149150
msg = "ERROR when compiling base_js_code! " \
150151
"See file #{file_name} to " \
151152
"correlate line numbers of error. Error is\n\n#{e.message}" \
152-
"\n\n#{e.backtrace.join("\n")}"
153+
"\n\n#{e.backtrace.join("\n")}" \
154+
"\n\n#{Utils.default_troubleshooting_section}"
153155
Rails.logger.error(msg)
154156
trace_js_code_used("Error when compiling JavaScript code for the context.", base_js_code,
155157
file_name, force: true)
@@ -227,7 +229,7 @@ def file_url_to_string(url)
227229
encoding_type = match[:encoding]
228230
response.body.force_encoding(encoding_type)
229231
rescue StandardError => e
230-
msg = "file_url_to_string #{url} failed\nError is: #{e}"
232+
msg = "file_url_to_string #{url} failed\nError is: #{e}\n\n#{Utils.default_troubleshooting_section}"
231233
raise ReactOnRails::Error, msg
232234
end
233235

lib/react_on_rails/utils.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ def self.invoke_and_exit_if_failed(cmd, failure_message)
5757
MSG
5858

5959
puts wrap_message(msg)
60+
puts ""
61+
puts default_troubleshooting_section
6062

6163
# Rspec catches exit without! in the exit callbacks
6264
exit!(1)
@@ -278,5 +280,15 @@ def self.prepend_to_file_if_text_not_present(file:, text_to_prepend:, regex:)
278280

279281
puts "Prepended\n#{text_to_prepend}to #{file}."
280282
end
283+
284+
def self.default_troubleshooting_section
285+
<<~DEFAULT
286+
📞 Get Help & Support:
287+
• 🚀 Professional Support: react_on_rails@shakacode.com (fastest resolution)
288+
• 💬 React + Rails Slack: https://invite.reactrails.com
289+
• 🆓 GitHub Issues: https://github.com/shakacode/react_on_rails/issues
290+
• 📖 Discussions: https://github.com/shakacode/react_on_rails/discussions
291+
DEFAULT
292+
end
281293
end
282294
end

lib/tasks/generate_packs.rake

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,24 @@ namespace :react_on_rails do
123123
puts Rainbow("=" * 80).red
124124
end
125125

126+
def show_help_and_support
127+
puts ""
128+
troubleshooting_content = ReactOnRails::Utils.default_troubleshooting_section
129+
# Display the troubleshooting content with color formatting
130+
troubleshooting_content.split("\n").each do |line|
131+
case line
132+
when /^📞/
133+
puts Rainbow(line).magenta.bold
134+
when /^\s*•\s*🚀/
135+
puts Rainbow(line).yellow
136+
when /^\s*•/
137+
puts Rainbow(line).cyan
138+
else
139+
puts Rainbow(line).white unless line.strip.empty?
140+
end
141+
end
142+
end
143+
126144
# rubocop:disable Metrics/AbcSize
127145
def handle_standard_error(error)
128146
puts ""
@@ -142,11 +160,7 @@ namespace :react_on_rails do
142160
puts Rainbow(" 2. Check Rails logs: tail -f log/development.log").white
143161
puts Rainbow(" 3. Verify all dependencies are installed: bundle install && npm install").white
144162
puts Rainbow(" 4. Clear cache: rm -rf tmp/cache").white
145-
puts ""
146-
puts Rainbow("📞 GET HELP:").magenta.bold
147-
puts Rainbow(" • Create an issue: https://github.com/shakacode/react_on_rails/issues").cyan
148-
puts Rainbow(" • Community discussions: https://github.com/shakacode/react_on_rails/discussions").cyan
149-
puts Rainbow(" • Professional support: https://www.shakacode.com/react-on-rails-pro").cyan
163+
show_help_and_support
150164
puts Rainbow("=" * 80).red
151165
end
152166
# rubocop:enable Metrics/AbcSize

0 commit comments

Comments
 (0)