Enhance UserMenu with GoodJob integration and update application layout
- Added `goodJobPath` to `UserMenuProps` and integrated a link to the Jobs Queue for admin users. - Updated the application layout to pass the new `goodJobPath` to the UserMenu component. - Configured routes to mount the GoodJob engine for admin users, enabling job management features. These changes improve the user experience by providing quick access to job management for administrators.
This commit is contained in:
@@ -8,6 +8,7 @@ interface UserMenuProps {
|
||||
signOutPath: string;
|
||||
csrfToken: string;
|
||||
globalStatesPath: string;
|
||||
goodJobPath: string;
|
||||
}
|
||||
|
||||
export const UserMenu: React.FC<UserMenuProps> = ({
|
||||
@@ -17,6 +18,7 @@ export const UserMenu: React.FC<UserMenuProps> = ({
|
||||
signOutPath,
|
||||
csrfToken,
|
||||
globalStatesPath,
|
||||
goodJobPath,
|
||||
}) => {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const menuRef = useRef<HTMLDivElement>(null);
|
||||
@@ -85,13 +87,22 @@ export const UserMenu: React.FC<UserMenuProps> = ({
|
||||
</div>
|
||||
|
||||
{userRole === 'admin' && (
|
||||
<a
|
||||
href={globalStatesPath}
|
||||
className="flex w-full items-center px-4 py-2 text-sm text-slate-700 hover:bg-slate-100"
|
||||
>
|
||||
<i className="fas fa-cogs mr-2 w-5" />
|
||||
<span>Global State</span>
|
||||
</a>
|
||||
<>
|
||||
<a
|
||||
href={globalStatesPath}
|
||||
className="flex w-full items-center px-4 py-2 text-sm text-slate-700 hover:bg-slate-100"
|
||||
>
|
||||
<i className="fas fa-cogs mr-2 w-5" />
|
||||
<span>Global State</span>
|
||||
</a>
|
||||
<a
|
||||
href={goodJobPath}
|
||||
className="flex w-full items-center px-4 py-2 text-sm text-slate-700 hover:bg-slate-100"
|
||||
>
|
||||
<i className="fas fa-tasks mr-2 w-5" />
|
||||
<span>Jobs Queue</span>
|
||||
</a>
|
||||
</>
|
||||
)}
|
||||
|
||||
<a
|
||||
|
||||
@@ -34,7 +34,8 @@
|
||||
editProfilePath: edit_user_registration_path,
|
||||
signOutPath: destroy_user_session_path,
|
||||
csrfToken: form_authenticity_token,
|
||||
globalStatesPath: global_states_path
|
||||
globalStatesPath: global_states_path,
|
||||
goodJobPath: good_job_path
|
||||
}) %>
|
||||
<% else %>
|
||||
<%= link_to new_user_session_path, class: "text-slate-600 hover:text-slate-900" do %>
|
||||
|
||||
@@ -63,9 +63,12 @@ Rails.application.routes.draw do
|
||||
end
|
||||
end
|
||||
|
||||
authenticate :user, ->(user) { user.admin? } do
|
||||
mount GoodJob::Engine => "jobs"
|
||||
end
|
||||
|
||||
scope constraints: VpnOnlyRouteConstraint.new do
|
||||
mount PgHero::Engine => "pghero"
|
||||
mount GoodJob::Engine => "jobs"
|
||||
namespace :api do
|
||||
get "search/user/:prefix", to: "search#user"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user