Skip to content
This repository was archived by the owner on Aug 8, 2019. It is now read-only.

Commit e41f7b1

Browse files
cristianbgpFrank Davis Condezo Fabian
authored and
Frank Davis Condezo Fabian
committed
Release 6 (#62)
* Refactor styles in show cards * Add responsive navbar * Add pictures for clubs in owner home * Refactor ui (#61) Refactor UI
1 parent ccad114 commit e41f7b1

38 files changed

+1077
-470
lines changed

README.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,40 @@
1-
# kampu
1+
# Kampu
2+
3+
<div align="center">
4+
<h2>An app to book your favorite sports fields</h2>
5+
<img src="./__docs__/screenshot.png">
6+
</div>
7+
8+
## Setup
9+
10+
The stack in this project is Rails + React.
11+
12+
We have `api` and `client`.
13+
14+
<hr/>
15+
16+
To setup the api:
17+
18+
First use `bundle` to install all the gems for the rails project
19+
20+
bundle install
21+
22+
Then you should setup the database with
23+
24+
rails db:setup
25+
26+
And finally, you should run it on a specific port. e.g. `4000`
27+
28+
rails s -p 4000
29+
30+
<hr/>
31+
32+
To setup the client:
33+
34+
First use `yarn` to install all the package dependencies for the react project
35+
36+
yarn install
37+
38+
And finally, you should run it, and by default it starts on the port `3000`
39+
40+
yarn start

__docs__/screenshot.png

447 KB
Loading

api/app/serializers/club_serializer.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class ClubSerializer < ActiveModel::Serializer
22
include Rails.application.routes.url_helpers
33

4-
attributes :id, :name, :address, :image, :schedule, :favorited, :favorited_count, :district, :latitude, :longitude, :sport_fields
4+
attributes :id, :name, :price, :address, :image, :schedule, :favorited, :favorited_count, :district, :latitude, :longitude, :sport_fields
55

66
def image
77
# rails_blob_path(object.image, only_path: true) if object.image.attached?
@@ -12,6 +12,10 @@ def image
1212
end
1313
end
1414

15+
def price
16+
self.object.sport_fields.minimum(:price_day)
17+
end
18+
1519
def favorited
1620
current_user ? current_user.favorited?(object) : false
1721
end

api/db/seeds.rb

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -78,31 +78,27 @@ def get_image(file_name)
7878
}
7979
}
8080

81-
regular_user = User.create(name: 'Lian Nivin', email: 'liam@kampu.pe', role: "regular", password: '123456')
82-
owner_user = User.create(name: 'Cristian Berly', email: 'berli@kampu.pe', role: "owner", password: '123456')
81+
owner_user = User.create(name: 'Frank Conde', email: 'frank@kampu.app', role: "owner", password: '123456')
82+
regular_user = User.create(name: 'Cristian Berly', email: 'cristian@kampu.app', role: "regular", password: '123456')
8383

8484
clubs.each do |club|
8585
image = club[:num_img].times.map { |i| get_image("#{club[:name]}/gallery_#{i + 1}.jpg") }
8686
club.delete(:num_img)
8787
Club.create(club.merge({image: image, schedule: schedule}))
8888
end
8989

90-
sportfield1 = SportField.create(name: "SportField #1", description: "Soccer 5vs5", price_day: 20, price_night: 40, club_id: 1)
91-
sportfield2 = SportField.create(name: "SportField #2", club_id: 2);
92-
SportField.create(name: "SportField #2", description: "Soccer 6vs6", price_day: 30, price_night: 60, club_id: 2)
93-
sportfield3 = SportField.create(name: "SportField #3", club_id: 1); SportField.create(name: "SportField #3", description: "Soccer 5vs5", price_day: 20, price_night: 40, club_id: 1)
90+
Club.all.each do |club|
91+
SportField.create(name: "SportField #1", description: "Soccer 5vs5", price_day: 20, price_night: 40, club_id: club.id)
92+
SportField.create(name: "SportField #2", description: "Soccer 6vs6", price_day: 30, price_night: 60, club_id: club.id)
93+
SportField.create(name: "SportField #3", description: "Soccer 5vs5", price_day: 20, price_night: 40, club_id: club.id)
94+
end
9495

95-
# favorites
9696
regular_user.favorite(Club.first)
9797
regular_user.favorite(Club.last)
98-
regular_user.bookings.create(date: Time.now, start_hour: 14, end_hour: 15, amount: 100, sport_field_id: sportfield1.id );
99-
100-
regular_user.bookings.create(date: Time.now, start_hour: 15, end_hour: 16, amount: 100, sport_field_id: sportfield1.id );
101-
102-
regular_user.bookings.create(date: Time.now, start_hour: 16, end_hour: 17, amount: 100, sport_field_id: sportfield1.id );
103-
104-
regular_user.bookings.create(date: Time.now, start_hour: 17, end_hour: 18, amount: 100, sport_field_id: sportfield1.id );
105-
106-
regular_user.bookings.create(date: Time.now, start_hour: 15, end_hour: 16, amount: 200, sport_field_id: sportfield2.id );
10798

108-
regular_user.bookings.create(date: Time.now, start_hour: 16, end_hour: 17, amount: 300, sport_field_id: sportfield3.id );
99+
regular_user.bookings.create(date: Time.now, start_hour: 14, end_hour: 15, amount: 100, sport_field_id: rand(SportField.all.size))
100+
regular_user.bookings.create(date: Time.now, start_hour: 15, end_hour: 16, amount: 100, sport_field_id: rand(SportField.all.size))
101+
regular_user.bookings.create(date: Time.now, start_hour: 16, end_hour: 17, amount: 100, sport_field_id: rand(SportField.all.size))
102+
regular_user.bookings.create(date: Time.now, start_hour: 17, end_hour: 18, amount: 100, sport_field_id: rand(SportField.all.size))
103+
regular_user.bookings.create(date: Time.now, start_hour: 15, end_hour: 16, amount: 200, sport_field_id: rand(SportField.all.size))
104+
regular_user.bookings.create(date: Time.now, start_hour: 16, end_hour: 17, amount: 300, sport_field_id: rand(SportField.all.size))

client/public/favicon.ico

1.52 KB
Binary file not shown.

client/public/index.html

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
4-
<head>
5-
<meta charset="utf-8" />
6-
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
7-
<meta name="viewport" content="width=device-width, initial-scale=1" />
8-
<meta name="theme-color" content="#000000" />
9-
<!--
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<meta name="theme-color" content="#fafafa" />
8+
<!--
109
manifest.json provides metadata used when your web app is installed on a
1110
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
1211
-->
13-
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
14-
<!--
12+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
13+
<!--
1514
Notice the use of %PUBLIC_URL% in the tags above.
1615
It will be replaced with the URL of the `public` folder during the build.
1716
Only files inside the `public` folder can be referenced from the HTML.
@@ -20,17 +19,20 @@
2019
work correctly both with client-side routing and a non-root public URL.
2120
Learn how to configure a non-root public URL by running `npm run build`.
2221
-->
23-
<meta name="language" content="en">
24-
<meta name="author" content="Team Codeable">
25-
<title>Kampu</title>
26-
<link href="https://fonts.googleapis.com/css?family=Rubik&display=swap" rel="stylesheet">
27-
<script src="https://js.stripe.com/v3/"></script>
28-
</head>
22+
<meta name="language" content="en" />
23+
<meta name="author" content="Team Codeable" />
24+
<title>Kampu</title>
25+
<link
26+
href="https://fonts.googleapis.com/css?family=Rubik&display=swap"
27+
rel="stylesheet"
28+
/>
29+
<script src="https://js.stripe.com/v3/"></script>
30+
</head>
2931

30-
<body>
31-
<noscript>You need to enable JavaScript to run this app.</noscript>
32-
<div id="root"></div>
33-
<!--
32+
<body>
33+
<noscript>You need to enable JavaScript to run this app.</noscript>
34+
<div id="root"></div>
35+
<!--
3436
This HTML file is a template.
3537
If you open it directly in the browser, you will see an empty page.
3638
@@ -40,6 +42,5 @@
4042
To begin the development, run `npm start` or `yarn start`.
4143
To create a production bundle, use `npm run build` or `yarn build`.
4244
-->
43-
</body>
44-
45+
</body>
4546
</html>

client/public/logo.png

10.4 KB
Loading

client/public/[email protected]

15.5 KB
Loading

client/public/[email protected]

19.9 KB
Loading

client/public/[email protected]

49.3 KB
Loading

client/public/manifest.json

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,36 @@
11
{
2-
"short_name": "React App",
3-
"name": "Create React App Sample",
2+
"name": "Kampu",
3+
"short_name": "Kampu",
4+
"start_url": ".",
5+
"display": "standalone",
6+
"background_color": "#fafafa",
7+
"description": "An app to book your favorite sports fields",
8+
"lang": "en-US",
9+
"orientation": "portrait-primary",
10+
"theme_color": "#663399",
411
"icons": [
512
{
6-
"src": "favicon.ico",
7-
"sizes": "64x64 32x32 24x24 16x16",
8-
"type": "image/x-icon"
13+
14+
"sizes": "512x512",
15+
"type": "image/png"
16+
},
17+
{
18+
19+
"sizes": "256x256",
20+
"type": "image/png"
21+
},
22+
{
23+
24+
"sizes": "192x192",
25+
"type": "image/png"
26+
},
27+
{
28+
"src": "logo.png",
29+
"sizes": "128x128 96x96 72x72 64x64 32x32 24x24 16x16",
30+
"type": "image/png"
931
}
1032
],
11-
"start_url": ".",
12-
"display": "standalone",
13-
"theme_color": "#000000",
14-
"background_color": "#ffffff"
33+
"related_applications": [],
34+
"prefer_related_applications": false,
35+
"categories": ["sports", "productivity"]
1536
}

client/src/assets/bg.jpg

823 KB
Loading

client/src/assets/owner.png

2.75 KB
Loading

client/src/assets/regular.png

2.58 KB
Loading

client/src/assets/soccer.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)