matey 0.1.1 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.devcontainer/devcontainer.json +1 -1
  3. data/CHANGELOG.md +1 -1
  4. data/COLOR_SCHEMES.md +24 -0
  5. data/COMPONENTS.md +75 -0
  6. data/Gemfile +2 -13
  7. data/Gemfile.lock +148 -143
  8. data/README.md +53 -100
  9. data/app/components/matey/active_users_component.html.erb +2 -2
  10. data/app/components/matey/active_users_component.rb +5 -3
  11. data/app/components/{application_component.rb → matey/application_component.rb} +3 -1
  12. data/app/components/matey/bounce_rate_component.html.erb +35 -0
  13. data/app/components/matey/bounce_rate_component.rb +24 -0
  14. data/app/components/matey/browser_os_breakdown_component.html.erb +38 -0
  15. data/app/components/matey/browser_os_breakdown_component.rb +11 -0
  16. data/app/components/matey/daily_active_users_component.html.erb +15 -0
  17. data/app/components/matey/daily_active_users_component.rb +11 -0
  18. data/app/components/matey/new_activity_component.html.erb +2 -2
  19. data/app/components/matey/new_activity_component.rb +5 -3
  20. data/app/components/matey/new_users_component.html.erb +2 -2
  21. data/app/components/matey/new_users_component.rb +5 -3
  22. data/app/components/matey/top_events_component.html.erb +2 -2
  23. data/app/components/matey/top_events_component.rb +4 -2
  24. data/app/components/matey/top_visited_pages_table_component.html.erb +2 -2
  25. data/app/components/matey/top_visited_pages_table_component.rb +4 -2
  26. data/app/components/matey/user_engagement_component.html.erb +27 -0
  27. data/app/components/matey/user_engagement_component.rb +12 -0
  28. data/app/components/matey/visits_by_day_of_week_component.html.erb +26 -0
  29. data/app/components/matey/visits_by_day_of_week_component.rb +24 -0
  30. data/docs/CONTRIBUTING.md +22 -0
  31. data/images/bounceRateComponent.png +0 -0
  32. data/images/colorSchemeBlue.png +0 -0
  33. data/images/colorSchemeNeutral.png +0 -0
  34. data/lib/helpers.rb +12 -0
  35. data/lib/matey/version.rb +1 -1
  36. data/lib/matey.rb +7 -2
  37. data/matey.gemspec +12 -5
  38. metadata +54 -12
@@ -0,0 +1,24 @@
1
+ require "ahoy_matey"
2
+
3
+ class Matey::VisitsByDayOfWeekComponent < Matey::ApplicationComponent
4
+ def initialize(visits:, time_window: 1.month, limit: 10, exclude_days: [], color_scheme: "neutral")
5
+ @time_window = time_window
6
+
7
+ # query for all the visits
8
+ all_visits = visits.where(started_at: time_window.ago..)
9
+
10
+ visits_by_day_of_week = {}
11
+
12
+ # get day of week from each visit. Incrase value of dayOfWeek key by 1 if key is already there else initialize key with value of 1
13
+ all_visits.each { |visit| visits_by_day_of_week.key?(visit.started_at.strftime("%A")) ? visits_by_day_of_week[(visit.started_at.strftime("%A"))] += 1 : visits_by_day_of_week[visit.started_at.strftime("%A")] = 1 }
14
+
15
+ # take out items from visits_by_day_of_week hashmap based on exclude_days parameter
16
+ if exclude_days.length > 0
17
+ exclude_days.each { |exclude| visits_by_day_of_week = visits_by_day_of_week.slice!(exclude) }
18
+ end
19
+
20
+ @visits_by_day_of_week = visits_by_day_of_week
21
+
22
+ @color_scheme = color_scheme(scheme: color_scheme)
23
+ end
24
+ end
@@ -0,0 +1,22 @@
1
+ ## Welcome to Matey's Contribution Guidelines
2
+ Bug reports and pull requests are welcome on GitHub at https://github.com/harled/matey.
3
+ This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct.](https://github.com/harled/matey/blob/master/CODE_OF_CONDUCT.md)
4
+
5
+ ### For New Contributors:
6
+ Be sure to take a look at the [README](https://github.com/harled/matey/blob/main/README.md) to get a sense of what Matey does and how it works
7
+
8
+ ### Contribution Steps:
9
+ Want to help us out? Here are some steps to make sure you are contributing according to our guidelines.
10
+
11
+ 1. Find an issue you like, or create a new issue [here.](https://github.com/harled/matey/issues)
12
+
13
+ Please ask if you have any questions or need clarification on creating a new issue, or related to any existing issue! 🤔
14
+
15
+ 2. Assign yourself to the issue and create a branch , following GitHub Issue's naming scheme. 🛠️
16
+ The naming scheme should follow `(#issueNumber-issue-name)` ie. `(#10-create-new-component)`
17
+
18
+ 3. Get on your local machine and [ensure you have the repo cloned.](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) Checkout the branch you just made with `git checkout branch-name` and pull the latest merged changes from the repo with `git pull origin main` to make sure you have the most up-to-date code from the repo. 👩‍💻
19
+ 4. Add your amazing changes along with any documentation you feel would be useful (ie. Update the README if necessary). Then commit and push your changes. 🌟
20
+ 5. Go back to the repo on GitHub and create a pull request! Then wait for an admin of the repo to get back to your pull request, address any comments, and once you are finally approved, merge your code into _Matey!_ 🎉
21
+
22
+ If you want some more tips on contributing to GitHub projects, [check out this resource from Data School](https://www.dataschool.io/how-to-contribute-on-github/)
Binary file
Binary file
Binary file
data/lib/helpers.rb ADDED
@@ -0,0 +1,12 @@
1
+ module ColorSchemeHelper
2
+ def color_scheme(scheme: "blue")
3
+ case scheme
4
+ when "blue"
5
+ "bg-primary text-light"
6
+ when "neutral"
7
+ "bg-light text-dark border-dark"
8
+ else
9
+ "bg-light text-dark border-dark"
10
+ end
11
+ end
12
+ end
data/lib/matey/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Matey
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.4"
5
5
  end
data/lib/matey.rb CHANGED
@@ -2,12 +2,17 @@
2
2
 
3
3
  require_relative "matey/version"
4
4
 
5
- require_relative "../app/components/application_component"
5
+ require_relative "../app/components/matey/application_component"
6
6
  require_relative "../app/components/matey/active_users_component"
7
+ require_relative "../app/components/matey/bounce_rate_component"
8
+ require_relative "../app/components/matey/new_activity_component"
7
9
  require_relative "../app/components/matey/new_users_component"
8
10
  require_relative "../app/components/matey/top_events_component"
9
- require_relative "../app/components/matey/new_activity_component"
10
11
  require_relative "../app/components/matey/top_visited_pages_table_component"
12
+ require_relative "../app/components/matey/user_engagement_component"
13
+ require_relative "../app/components/matey/daily_active_users_component"
14
+ require_relative "../app/components/matey/visits_by_day_of_week_component"
15
+ require_relative "../app/components/matey/browser_os_breakdown_component"
11
16
 
12
17
  module Matey
13
18
  class Error < StandardError; end
data/matey.gemspec CHANGED
@@ -3,11 +3,16 @@ require_relative "lib/matey/version"
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "matey"
5
5
  spec.version = Matey::VERSION
6
- spec.authors = ["Suvasan Krishnasamy", "Jon Loos", "Caitlin Henry", "Chris Young"]
7
- spec.email = ["suvasan@harled.ca", "jon@harled.ca", "caitlin@harled.ca", "chris@harled.ca"]
6
+
7
+ # Former authors include:
8
+ # Suvasan Krishnasamy / suvasan@harled.ca
9
+ # Caitlin Henry / caitlin@harled.ca
10
+
11
+ spec.authors = ["Jon Loos", "Chris Young"]
12
+ spec.email = ["jon@harled.ca", "chris@harled.ca"]
8
13
 
9
14
  spec.summary = "Track user engagement using Ahoy and ViewComponents."
10
- spec.description = "ViewComponents that helpful in viewing user engagement metrics from Ahoy."
15
+ spec.description = "ViewComponents that are helpful in viewing user engagement metrics from Ahoy."
11
16
  spec.homepage = "https://github.com/harled/matey"
12
17
  spec.license = "MIT"
13
18
  spec.required_ruby_version = ">= 2.6.0"
@@ -29,14 +34,16 @@ Gem::Specification.new do |spec|
29
34
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
35
  spec.require_paths = ["lib"]
31
36
 
32
- spec.add_dependency "view_component", "~> 2.0"
37
+ spec.add_dependency "view_component", "~> 2.74"
33
38
  spec.add_dependency "ahoy_matey", "~> 4.0"
34
39
 
35
40
  spec.add_development_dependency "rspec-rails", "~> 5.0"
36
- spec.add_development_dependency "factory_bot", "~> 6.0"
41
+ spec.add_development_dependency "factory_bot_rails", "~> 6.0"
37
42
  spec.add_development_dependency "sprockets-rails", "~> 3.2.2"
38
43
  spec.add_development_dependency "sqlite3", "~> 1.0"
39
44
  spec.add_development_dependency "debug", "~> 1.0"
45
+ spec.add_development_dependency "standard", "~> 1.3"
46
+ spec.add_development_dependency "rake", "~> 13.0"
40
47
 
41
48
  # For more information and examples about making a new gem, check out our
42
49
  # guide at: https://bundler.io/guides/creating_gem.html
metadata CHANGED
@@ -1,17 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: matey
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
- - Suvasan Krishnasamy
8
7
  - Jon Loos
9
- - Caitlin Henry
10
8
  - Chris Young
11
9
  autorequire:
12
10
  bindir: exe
13
11
  cert_chain: []
14
- date: 2022-04-26 00:00:00.000000000 Z
12
+ date: 2023-06-21 00:00:00.000000000 Z
15
13
  dependencies:
16
14
  - !ruby/object:Gem::Dependency
17
15
  name: view_component
@@ -19,14 +17,14 @@ dependencies:
19
17
  requirements:
20
18
  - - "~>"
21
19
  - !ruby/object:Gem::Version
22
- version: '2.0'
20
+ version: '2.74'
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
24
  requirements:
27
25
  - - "~>"
28
26
  - !ruby/object:Gem::Version
29
- version: '2.0'
27
+ version: '2.74'
30
28
  - !ruby/object:Gem::Dependency
31
29
  name: ahoy_matey
32
30
  requirement: !ruby/object:Gem::Requirement
@@ -56,7 +54,7 @@ dependencies:
56
54
  - !ruby/object:Gem::Version
57
55
  version: '5.0'
58
56
  - !ruby/object:Gem::Dependency
59
- name: factory_bot
57
+ name: factory_bot_rails
60
58
  requirement: !ruby/object:Gem::Requirement
61
59
  requirements:
62
60
  - - "~>"
@@ -111,11 +109,38 @@ dependencies:
111
109
  - - "~>"
112
110
  - !ruby/object:Gem::Version
113
111
  version: '1.0'
114
- description: ViewComponents that helpful in viewing user engagement metrics from Ahoy.
112
+ - !ruby/object:Gem::Dependency
113
+ name: standard
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - "~>"
117
+ - !ruby/object:Gem::Version
118
+ version: '1.3'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: '1.3'
126
+ - !ruby/object:Gem::Dependency
127
+ name: rake
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: '13.0'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: '13.0'
140
+ description: ViewComponents that are helpful in viewing user engagement metrics from
141
+ Ahoy.
115
142
  email:
116
- - suvasan@harled.ca
117
143
  - jon@harled.ca
118
- - caitlin@harled.ca
119
144
  - chris@harled.ca
120
145
  executables: []
121
146
  extensions: []
@@ -128,14 +153,22 @@ files:
128
153
  - ".standard.yml"
129
154
  - CHANGELOG.md
130
155
  - CODE_OF_CONDUCT.md
156
+ - COLOR_SCHEMES.md
157
+ - COMPONENTS.md
131
158
  - Gemfile
132
159
  - Gemfile.lock
133
160
  - LICENSE.txt
134
161
  - README.md
135
162
  - Rakefile
136
- - app/components/application_component.rb
137
163
  - app/components/matey/active_users_component.html.erb
138
164
  - app/components/matey/active_users_component.rb
165
+ - app/components/matey/application_component.rb
166
+ - app/components/matey/bounce_rate_component.html.erb
167
+ - app/components/matey/bounce_rate_component.rb
168
+ - app/components/matey/browser_os_breakdown_component.html.erb
169
+ - app/components/matey/browser_os_breakdown_component.rb
170
+ - app/components/matey/daily_active_users_component.html.erb
171
+ - app/components/matey/daily_active_users_component.rb
139
172
  - app/components/matey/new_activity_component.html.erb
140
173
  - app/components/matey/new_activity_component.rb
141
174
  - app/components/matey/new_users_component.html.erb
@@ -144,12 +177,21 @@ files:
144
177
  - app/components/matey/top_events_component.rb
145
178
  - app/components/matey/top_visited_pages_table_component.html.erb
146
179
  - app/components/matey/top_visited_pages_table_component.rb
180
+ - app/components/matey/user_engagement_component.html.erb
181
+ - app/components/matey/user_engagement_component.rb
182
+ - app/components/matey/visits_by_day_of_week_component.html.erb
183
+ - app/components/matey/visits_by_day_of_week_component.rb
184
+ - docs/CONTRIBUTING.md
147
185
  - images/.DS_Store
148
186
  - images/activeUsersComponent.png
187
+ - images/bounceRateComponent.png
188
+ - images/colorSchemeBlue.png
189
+ - images/colorSchemeNeutral.png
149
190
  - images/newActivityComponent.png
150
191
  - images/newUsersComponent.png
151
192
  - images/topEventsComponent.png
152
193
  - images/topVisitedPages.png
194
+ - lib/helpers.rb
153
195
  - lib/matey.rb
154
196
  - lib/matey/version.rb
155
197
  - matey.gemspec
@@ -176,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
218
  - !ruby/object:Gem::Version
177
219
  version: '0'
178
220
  requirements: []
179
- rubygems_version: 3.3.7
221
+ rubygems_version: 3.4.10
180
222
  signing_key:
181
223
  specification_version: 4
182
224
  summary: Track user engagement using Ahoy and ViewComponents.