Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes#54 Fixes#33 build the root pages & Logout #56

Merged
merged 24 commits into from
Jan 4, 2022
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,6 @@ GEM
nokogiri (1.12.5)
mini_portile2 (~> 2.6.1)
racc (~> 1.4)
nokogiri (1.12.5-x86_64-linux)
racc (~> 1.4)
orm_adapter (0.5.0)
parallel (1.21.0)
parser (3.0.3.2)
Expand Down
Binary file added app/assets/images/logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/assets/images/miru-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

class HomeController < ApplicationController
class TimeTrackingsController < ApplicationController
def index
render
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: true

module HomeHelper
module TimeTrackingsHelper
end
5 changes: 5 additions & 0 deletions app/javascript/images/miru-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions app/javascript/packs/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import * as ActiveStorage from "@rails/activestorage";
import Rails from "@rails/ujs";
import * as ReactRailsUJS from "react_ujs";

import "alpine-turbo-drive-adapter";
require("alpinejs");

import "@fontsource/plus-jakarta-sans";

global.toastr = require("toastr");
Expand Down
5 changes: 3 additions & 2 deletions app/views/dashboard/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
<h1>Dashboard#index</h1>
<p>Find me in app/views/dashboard/index.html.erb</p>
<div class="" id="root-page">
<%= render "partial/navbar" %>
</div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a new empty line

14 changes: 6 additions & 8 deletions app/views/devise/sessions/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@
<%= f.password_field :password, autocomplete: "current-password", class: "p-2 w-full bg-miru-grey-200 text-sm" %>
</div>
<% if devise_mapping.rememberable? %>
<%
=begin%>
<div class="field">
<%= f.check_box :remember_me %>
<%= f.label :remember_me %>
</div>
<%
=end%>
<% begin %>
<div class="field">
<%= f.check_box :remember_me %>
<%= f.label :remember_me %>
</div>
<% end %>
<% end %>
<div class="actions mt-3">
<%= f.submit "SIGN IN", class: "p-2 w-full bg-miru-grey-400 font-bold text-white text-base hover:bg-miru-black-1000 cursor-pointer" %>
Expand Down
1 change: 0 additions & 1 deletion app/views/home/index.html.erb

This file was deleted.

2 changes: 1 addition & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<%= csp_meta_tag %>
<%#= stylesheet_link_tag "inter-font", "data-turbo-track": "reload" %>
<%= stylesheet_pack_tag "application" %>
<%= javascript_pack_tag 'application' %>
<%= javascript_pack_tag "application"%>
</head>
<body>
<main class="min-h-screen bg-miru-white-400">
Expand Down
137 changes: 137 additions & 0 deletions app/views/partial/_navbar.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
<nav class="bg-white shadow" x-data="{ isOpen: false}">
<div class="max-w-8xl mx-auto px-2 md:px-11">
<div class="relative flex justify-between h-16">
<div class="absolute inset-y-0 left-0 flex items-center md:hidden">
<!-- Mobile menu button -->
<button type="button" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-indigo-500" aria-controls="mobile-menu" aria-expanded="false" @click="isOpen = !isOpen" @keydown.escape="isOpen = false">
<span class="sr-only">Open main menu</span>
<!--
Icon when menu is closed.

Heroicon name: outline/menu

Menu open: "hidden", Menu closed: "block"
-->
<div>
<svg class="block h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
</svg>
<!--
Icon when menu is open.

Heroicon name: outline/x

Menu open: "block", Menu closed: "hidden"
-->
<svg class="hidden h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</div>
</button>
</div>
<div class="flex-1 flex items-center justify-center md:items-stretch md:justify-start">

<div class="flex-shrink-0 flex items-center">
<img class="block lg:hidden h-8 w-auto md:mr-12" src="app/javascript/images/miru-logo.svg" alt="miru web">
<img class="hidden lg:block h-8 w-auto lg:mr-32" src="app/javascript/images/miru-logo.svg" alt="miru web">
</div>

<div class="hidden md:mx-3 md:flex md:space-x-2 lg:space-x-8">
<!-- Current: "border-indigo-500 text-gray-900", Default: "border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700" -->
<% if (current_user.role == "admin" || current_user.role == "owner") %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<% if (current_user.role == "admin" || current_user.role == "owner") %>
<% if (current_user.admin? || current_user.owner?) %>

Copy link
Contributor Author

@aniketkaushik aniketkaushik Jan 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

owner is yet to get defined.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add the owner key to the role enum

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

<a href="#" class="border-transparent text-gray-500 hover:text-gray-700 inline-flex items-center px-1 pt-1 text-sm font-medium">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<%= request.path == '/' ? '' : '' %>
You can use this condition for active tab checking.

Dashboard
</a>
<% end %>
<a href="#" class="text-miru-hanpurple-1000 inline-flex items-center px-1 pt-1 text-sm font-medium">
Time Tracking
</a>
<% if (current_user.role == "admin" || current_user.role == "owner") %>
<a href="#" class="border-transparent text-gray-500 hover:text-gray-700 inline-flex items-center px-1 pt-1 text-sm font-medium">
Team
</a>
<% end %>
<a href="#" class="border-transparent text-gray-500 hover:text-gray-700 inline-flex items-center px-1 pt-1 text-sm font-medium">
Clients
</a>
<a href="#" class="border-transparent text-gray-500 hover:text-gray-700 inline-flex items-center px-1 pt-1 text-sm font-medium">
Projects
</a>
<% if (current_user.role == "admin" || current_user.role == "owner") %>
<a href="#" class="border-transparent text-gray-500 hover:text-gray-700 inline-flex items-center px-1 pt-1 text-sm font-medium">
Invoice
</a>
<% end %>
<% if (current_user.role == "admin" || current_user.role == "owner") %>
<a href="#" class="border-transparent text-gray-500 hover:text-gray-700 inline-flex items-center px-1 pt-1 text-sm font-medium">
Report
</a>
<% end %>
</div>

</div>

<div class="absolute inset-y-0 right-0 flex items-center pr-2 md:static md:inset-auto md:ml-6 md:pr-0">

<button type="button" class="bg-white p-1 rounded-full text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
<span class="sr-only">View notifications</span>
<!-- Heroicon name: outline/bell -->
<svg class="h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9" />
</svg>
</button>

<!-- Profile dropdown -->
<div class="ml-3 relative" x-data="{ isOpen: false}">
<div>
<button type="button" class="bg-white rounded-full flex text-sm focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500" id="user-menu-button" aria-expanded="false" aria-haspopup="true" @click="isOpen = !isOpen" @keydown.escape="isOpen = false">
<span class="sr-only">Open user menu</span>
<img class="h-8 w-8 rounded-full" src="" alt="profile">
</button>
</div>

<!--
Dropdown menu, show/hide based on menu state.

Entering: "transition ease-out duration-200"
From: "transform opacity-0 scale-95"
To: "transform opacity-100 scale-100"
Leaving: "transition ease-in duration-75"
From: "transform opacity-100 scale-100"
To: "transform opacity-0 scale-95"
-->
<div x-show="isOpen" @click.away="isOpen = false">
<div class="origin-top-right absolute right-0 mt-2 w-48 rounded-md shadow-lg py-1 bg-white ring-1 ring-black ring-opacity-5 focus:outline-none" role="menu" aria-orientation="vertical" aria-labelledby="user-menu-button" tabindex="-1">
<!-- Active: "bg-gray-100", Not Active: "" -->
<a href="#" class="block px-4 py-2 text-sm text-gray-700" role="menuitem" tabindex="-1" id="user-menu-item-0">Your Profile</a>
<a href="#" class="block px-4 py-2 text-sm text-gray-700" role="menuitem" tabindex="-1" id="user-menu-item-1">Settings</a>
<%= button_to "logout", destroy_user_session_path, method: :delete, class: "block px-4 py-2 text-sm text-gray-700", role: "menuitem", tabindex: "-1", id: "user-menu-item-2"%>
</div>
</div>
</div>
</div>
</div>
</div>

<!-- Mobile menu, show/hide based on menu state. -->
<div class="flex">
<div class="md:hidden">
<div class="pt-2 pb-4 space-y-1" x-show="isOpen" @click.away="isOpen = false">
<!-- Current: "bg-indigo-50 border-indigo-500 text-indigo-700", Default: "border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700" -->
<% if (current_user.role == "admin" || current_user.role == "owner") %>
<a href="#" class="border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700 block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Dashboard</a>
<% end %>
<a href="#" class="bg-indigo-50 border-indigo-500 text-indigo-700 block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Time Tracking</a>
<% if (current_user.role == "admin" || current_user.role == "owner") %>
<a href="#" class="border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700 block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Team</a>
<% end %>
<a href="#" class="border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700 block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Clients</a>
<a href="#" class="border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700 block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Projects</a>
<% if (current_user.role == "admin" || current_user.role == "owner") %>
<a href="#" class="border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700 block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Invoice</a>
<a href="#" class="border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700 block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Report</a>
<% end %>
</div>
</div>
</div>
</nav>
5 changes: 5 additions & 0 deletions app/views/time_trackings/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<% if user_signed_in? %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this condition.
We already have the athenticate_user! condition in the application controller.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

<div class="" id="root-page">
<%= render "partial/navbar" %>
</div>
<% end %>
5 changes: 1 addition & 4 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

Rails.application.routes.draw do
devise_for :users, controllers: { registrations: "users/registrations" }

root "dashboard#index"
root "time_trackings#index"
resources :dashboard, only: [:index]

get "*path", to: "home#index", via: :all
end
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"@types/react-dom": "^17.0.11",
"@typescript-eslint/eslint-plugin": "^5.7.0",
"@typescript-eslint/parser": "^5.7.0",
"alpine-turbo-drive-adapter": "^2.0.0",
"alpinejs": "^2.2.5",
"autoprefixer": "~9",
"axios": "^0.24.0",
"babel-plugin-js-logger": "^1.0.17",
Expand Down
5 changes: 5 additions & 0 deletions public/miru-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Empty file.
57 changes: 54 additions & 3 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,62 @@ module.exports = {
1000: "#303A4B",
},
'miru-grey': {
200: "#F5F4F4",
400: "#C4C4C4",
1000: "#CDD6DF",
600: "#D7DEE5",
400: "#E1E6EC",
200: "#EBEFF2",
100: "#F5F7F9",
},
'miru-white': {
400: "#FFFFFF",
1000: "#FFFFFF",
},
'miru-darkpurple': {
1000: "#1D1A31",
600: "#4A485A",
400: "#777683",
200: "#A5A3AD",
100: "#D2D1D6"
},
'miru-hanpurple': {
1000: "#5B34EA",
600: "#7C5DEE",
400: "#9D85F2",
200: "#BDAEF7",
100: "#DED6FB",
},
'miru-alertgreen': {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'miru-alertgreen': {
'miru-alert-green': {

@aniket-k-kaushik please follow the same pattern in other as well

1000: "#564210",
800: "#10562C",
400: "#A9EFC5",
},
'miru-alertpink': {
400: "#EFA9A9"
},
'miru-alertblue': {
1000: "#104556",
400: "#A9DEEF",
},
'miru-alertyellow': {
400: "#EFDBA9",
},
'miru-alertred': {
1000: "#561010",
},
'miru-chartgreen':{
600: "#058C42",
400: "#0DA163",
},
'miru-chartblue': {
600: "#0E79B2",
},
'miru-chartpink': {
600: "#BF1363",
},
'miru-chartorange': {
600: "#F39237",
},
'miru-chartpurple': {
600: "#7768AE",
},
},
fontFamily :{
Expand Down
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1506,6 +1506,16 @@ alphanum-sort@^1.0.0:
resolved "https://registry.yarnpkg.com/alphanum-sort/-/alphanum-sort-1.0.2.tgz#97a1119649b211ad33691d9f9f486a8ec9fbe0a3"
integrity sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM=

alpine-turbo-drive-adapter@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/alpine-turbo-drive-adapter/-/alpine-turbo-drive-adapter-2.0.0.tgz#16ecd73cb549e1812f5c9fd605e2e7e51c00c930"
integrity sha512-Hspm4IX2UNxriAkdNjAsLdDX1/Euaksnj5dc4+M/0/xsMxAEiMOkt+7ZWtU8GSFR87iS3PixBh/n76Ci6yeDbQ==

alpinejs@^2.2.5:
version "2.8.2"
resolved "https://registry.yarnpkg.com/alpinejs/-/alpinejs-2.8.2.tgz#b14ec21ae3cd78dcee4aed0a78ed0f01b676dac4"
integrity sha512-5yOUtckn4CBp0qsHpo2qgjZyZit84uXvHbB7NJ27sn4FA6UlFl2i9PGUAdTXkcbFvvxDJBM+zpOD8RuNYFvQAw==

ansi-colors@^3.0.0:
version "3.2.4"
resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-3.2.4.tgz#e3a3da4bfbae6c86a9c285625de124a234026fbf"
Expand Down