Skip to content

Commit

Permalink
pages redesign
Browse files Browse the repository at this point in the history
  • Loading branch information
kortirso committed Feb 25, 2024
1 parent 3d1439a commit b92958a
Show file tree
Hide file tree
Showing 48 changed files with 551 additions and 434 deletions.
4 changes: 4 additions & 0 deletions app/assets/images/icons/close.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 18 additions & 11 deletions app/assets/stylesheets/application.tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
}

.btn-primary {
@apply btn bg-amber-200 border border-amber-300 hover:bg-amber-300 text-stone-700;
@apply btn bg-goldeen-support border border-goldeen-supportMiddle text-stone-700;
}

.btn-info {
Expand All @@ -46,26 +46,22 @@

.btn-transfer {
@apply flex justify-center items-center text-stone-700 cursor-pointer rounded;
@apply bg-amber-200 hover:bg-amber-300 border border-amber-300;
@apply bg-goldeen-support border border-goldeen-supportMiddle;

width: 26px;
height: 26px;
}

.user-navigation-link {
@apply flex flex-row items-center p-2 pl-4 text-white;
}

.user-navigation-link img {
@apply w-8 h-8 mr-2;
@apply flex flex-row items-center p-2 border-b-2 border-transparent;
}

.user-navigation-link:hover {
@apply bg-amber-200 text-stone-700;
@apply text-stone-700 border-goldeen-gray;
}

.user-navigation-link.active {
@apply bg-amber-300 shadow text-stone-700;
@apply text-stone-700 border-goldeen-supportMiddle;
}

.form-field {
Expand Down Expand Up @@ -349,7 +345,7 @@
}

.badge-danger {
@apply badge bg-orange-700 border border-orange-800 text-white;
@apply badge bg-goldeen-supportDark border border-orange-800 text-white;
}

.badge-small {
Expand Down Expand Up @@ -432,6 +428,17 @@
}

.navigation-menu:not(.hidden) {
@apply absolute w-full z-10 bg-stone-700 top-14;
@apply fixed left-0 top-0 bottom-0 w-full z-10;
}

.navigation-menu-background {
@apply absolute left-0 top-0 bottom-0 w-full;

background: #000;
opacity: .5;
}

.navigation-menu-content {
@apply absolute left-0 top-0 bottom-0 bg-goldeen-dark w-full sm:w-80;
}
}
2 changes: 1 addition & 1 deletion app/controllers/admin/banned_emails_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Admin
class BannedEmailsController < AdminController
class BannedEmailsController < Admin::BaseController
include Deps[
create_form: 'forms.banned_emails.create',
update_service: 'services.persisters.users.update'
Expand Down
17 changes: 17 additions & 0 deletions app/controllers/admin/base_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

module Admin
class BaseController < ApplicationController
before_action :authorize_admin

layout 'admin'

private

def authorize_admin
return if Current.user.admin?

redirect_to home_path, alert: t('controllers.admin.permission')
end
end
end
2 changes: 1 addition & 1 deletion app/controllers/admin/feedbacks_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Admin
class FeedbacksController < AdminController
class FeedbacksController < Admin::BaseController
before_action :find_feedbacks, only: %i[index]

def index; end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/leagues_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Admin
class LeaguesController < AdminController
class LeaguesController < Admin::BaseController
include Deps[create_form: 'forms.leagues.create']

before_action :find_leagues, only: %i[index]
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/players_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Admin
class PlayersController < AdminController
class PlayersController < Admin::BaseController
include Deps[
create_form: 'forms.players.create',
update_form: 'forms.players.update',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Admin
module Seasons
module Games
class StatisticsController < AdminController
class StatisticsController < Admin::BaseController
before_action :find_game

def index
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/seasons/games_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module Admin
module Seasons
class GamesController < AdminController
class GamesController < Admin::BaseController
include Deps[
create_form: 'forms.games.create',
update_form: 'forms.games.update'
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/seasons/injuries_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module Admin
module Seasons
class InjuriesController < AdminController
class InjuriesController < Admin::BaseController
include Deps[
create_form: 'forms.injuries.create',
update_form: 'forms.injuries.update'
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/seasons/teams_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module Admin
module Seasons
class TeamsController < AdminController
class TeamsController < Admin::BaseController
before_action :find_season, only: %i[index show]
before_action :find_seasons_teams, only: %i[index]
before_action :find_seasons_team, only: %i[show]
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/seasons/teams_players_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module Admin
module Seasons
class TeamsPlayersController < AdminController
class TeamsPlayersController < Admin::BaseController
include Deps[
create_form: 'forms.teams.players.create',
update_form: 'forms.teams.players.update'
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/seasons_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Admin
class SeasonsController < AdminController
class SeasonsController < Admin::BaseController
include Deps[
create_form: 'forms.seasons.create',
to_bool: 'to_bool'
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/users_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Admin
class UsersController < AdminController
class UsersController < Admin::BaseController
before_action :find_users, only: %i[index]

def index; end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/weeks_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Admin
class WeeksController < AdminController
class WeeksController < Admin::BaseController
include Deps[update_form: 'forms.weeks.update']

before_action :find_weeks, only: %i[index]
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/welcome_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Admin
class WelcomeController < AdminController
class WelcomeController < Admin::BaseController
def index; end
end
end
15 changes: 0 additions & 15 deletions app/controllers/admin_controller.rb

This file was deleted.

1 change: 1 addition & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ApplicationController < ActionController::Base
include Parameterable
include Watchable

# TODO: remember to skip redundant before actions in Api::Frontend::BaseController, Admin::BaseController
before_action :authenticate, except: %i[page_not_found]
before_action :check_email_confirmation, except: %i[page_not_found]
before_action :check_email_ban, except: %i[page_not_found]
Expand Down
14 changes: 14 additions & 0 deletions app/javascript/application.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,20 @@ document.addEventListener('DOMContentLoaded', () => {
});
};

const mobileMenuCloseButton = document.querySelector('#navigation-menu-close-button');
if (mobileMenuCloseButton) {
mobileMenuCloseButton.addEventListener('click', () => {
document.querySelector('.navigation-menu').classList.toggle('hidden');
});
};

const mobileMenuBackground = document.querySelector('.navigation-menu-background');
if (mobileMenuBackground) {
mobileMenuBackground.addEventListener('click', () => {
document.querySelector('.navigation-menu').classList.toggle('hidden');
});
};

// Clicking outside of an open dropdown menu closes it
window.addEventListener('click', function (e) {
if (!e.target.matches('.dropdown-toggle')) {
Expand Down
4 changes: 2 additions & 2 deletions app/javascript/components/Squad/Squad.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -393,13 +393,13 @@ export const Squad = ({
<section className="relative">
<div className="absolute w-full top-0 flex flex-row justify-center">
<p
className="bg-amber-200 hover:bg-amber-300 border border-amber-300 text-sm py-1 px-2 rounded cursor-pointer mr-2"
className="btn-primary btn-small mr-2"
onClick={() => setPageState({ ...pageState, viewMode: 'field' })}
>
{strings.squadPoints.fieldView}
</p>
<p
className="bg-amber-200 hover:bg-amber-300 border border-amber-300 text-sm py-1 px-2 rounded cursor-pointer"
className="btn-primary btn-small"
onClick={() => setPageState({ ...pageState, viewMode: 'list' })}
>
{strings.squadPoints.listView}
Expand Down
Loading

0 comments on commit b92958a

Please sign in to comment.