Skip to content

Commit

Permalink
Merge pull request #15643 from opf/feature/54733-primerise-the-activi…
Browse files Browse the repository at this point in the history
…ty-panel

Feature/54733 primerise the activity panel
  • Loading branch information
akabiru authored Oct 17, 2024
2 parents dc02c84 + 26ba6cb commit 6995413
Show file tree
Hide file tree
Showing 67 changed files with 4,797 additions and 20 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/pullpreview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
echo "OPENPROJECT_FEATURE__SHOW__CHANGES__ACTIVE=true" >> .env.pullpreview
echo "OPENPROJECT_LOOKBOOK__ENABLED=true" >> .env.pullpreview
echo "OPENPROJECT_HSTS=false" >> .env.pullpreview
echo "OPENPROJECT_FEATURE_PRIMERIZED_WORK_PACKAGE_ACTIVITIES_ACTIVE=true" >> .env.pullpreview
echo "OPENPROJECT_NOTIFICATIONS_POLLING_INTERVAL=10000" >> .env.pullpreview
- name: Boot as BIM edition
if: contains(github.ref, 'bim/') || contains(github.head_ref, 'bim/')
run: |
Expand Down
5 changes: 5 additions & 0 deletions app/components/_index.sass
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
@import "work_packages/activities_tab/index_component"
@import "work_packages/activities_tab/journals/new_component"
@import "work_packages/activities_tab/journals/index_component"
@import "work_packages/activities_tab/journals/item_component"
@import "work_packages/activities_tab/journals/item_component/details"
@import "shares/modal_body_component"
@import "shares/invite_user_form_component"
@import "work_packages/details/tab_component"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<%=
content_tag("turbo-frame", id: "work-package-activities-tab-content") do
unless error_message.blank?
render(Primer::Alpha::Banner.new(scheme: :danger)) { error_message }
end
end
%>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# frozen_string_literal: true

# -- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2023 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
# ++

module WorkPackages
module ActivitiesTab
class ErrorFrameComponent < ApplicationComponent
include ApplicationHelper
include OpPrimer::ComponentHelpers

def initialize(error_message: nil)
super

@error_message = error_message
end

attr_reader :error_message
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<%=
component_wrapper do
unless error_message.blank?
render(Primer::Alpha::Banner.new(scheme: :danger, dismiss_scheme: :hide)) { error_message }
end
end
%>
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# frozen_string_literal: true

# -- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2023 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
# ++

module WorkPackages
module ActivitiesTab
class ErrorStreamComponent < ApplicationComponent
include ApplicationHelper
include OpPrimer::ComponentHelpers
include OpTurbo::Streamable

def initialize(error_message: nil)
super

@error_message = error_message
end

attr_reader :error_message
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<%=
content_tag("turbo-frame", id: "work-package-activities-tab-content") do
flex_layout(classes: "work-packages-activities-tab-index-component") do |activties_tab_wrapper_container|
activties_tab_wrapper_container.with_row(classes: "work-packages-activities-tab-index-component--errors") do
render(
WorkPackages::ActivitiesTab::ErrorStreamComponent.new
)
end
activties_tab_wrapper_container.with_row do
component_wrapper(data: wrapper_data_attributes) do
flex_layout do |activties_tab_container|
activties_tab_container.with_row(mb: 2) do
render(
WorkPackages::ActivitiesTab::Journals::FilterAndSortingComponent.new(
work_package:,
filter:
)
)
end
activties_tab_container.with_row(flex_layout: true, mt: 3) do |journals_wrapper_container|
journals_wrapper_container.with_row(
classes: "work-packages-activities-tab-index-component--journals-container work-packages-activities-tab-index-component--journals-container_with-initial-input-compensation",
data: { "work-packages--activities-tab--index-target": "journalsContainer" }
) do
render(
WorkPackages::ActivitiesTab::Journals::IndexComponent.new(work_package:, filter:)
)
end
if adding_comment_allowed?
journals_wrapper_container.with_row(
classes: "work-packages-activities-tab-index-component--input-container work-packages-activities-tab-index-component--input-container_sort-#{journal_sorting}",
mt: 3,
mb: [3, nil, nil, nil, 0],
pt: 2,
pb: 2,
pl: 3,
pr: [3, nil, nil, nil, 2],
border: [nil, nil, nil, nil, :top],
border_radius: [2, nil, nil, nil, 0],
bg: :subtle
) do
render(
WorkPackages::ActivitiesTab::Journals::NewComponent.new(work_package:)
)
end
end
end
end
end
end
end
end
%>
84 changes: 84 additions & 0 deletions app/components/work_packages/activities_tab/index_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# frozen_string_literal: true

# -- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2023 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
# ++

module WorkPackages
module ActivitiesTab
class IndexComponent < ApplicationComponent
include ApplicationHelper
include OpPrimer::ComponentHelpers
include OpTurbo::Streamable

def initialize(work_package:, filter: :all)
super

@work_package = work_package
@filter = filter
end

private

attr_reader :work_package, :filter

def wrapper_data_attributes
{
test_selector: "op-wp-activity-tab",
controller: "work-packages--activities-tab--index",
"application-target": "dynamic",
"work-packages--activities-tab--index-update-streams-url-value": update_streams_work_package_activities_url(
work_package
),
"work-packages--activities-tab--index-sorting-value": journal_sorting,
"work-packages--activities-tab--index-filter-value": filter,
"work-packages--activities-tab--index-user-id-value": User.current.id,
"work-packages--activities-tab--index-work-package-id-value": work_package.id,
"work-packages--activities-tab--index-polling-interval-in-ms-value": polling_interval,
"work-packages--activities-tab--index-notification-center-path-name-value": notifications_path
}
end

def journal_sorting
User.current.preference&.comments_sorting || "desc"
end

def polling_interval
# Polling interval should only be adjustable in test environment
if Rails.env.test?
ENV["WORK_PACKAGES_ACTIVITIES_TAB_POLLING_INTERVAL_IN_MS"].presence || 10000
else
10000
end
end

def adding_comment_allowed?
User.current.allowed_in_project?(:add_work_package_notes, @work_package.project)
end
end
end
end
36 changes: 36 additions & 0 deletions app/components/work_packages/activities_tab/index_component.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.work-packages-activities-tab-index-component
&--errors
position: absolute
width: calc(100% - 22px)
z-index: 11
@media screen and (max-width: $breakpoint-xl)
position: fixed
bottom: 20px
width: calc(100% - 30px)
&--journals-container
z-index: 10
padding-top: 3px
overflow-y: auto

&_with-initial-input-compensation
margin-bottom: 65px // initial margin-bottom, will be increased by stimulus when opening ckeditor
@media screen and (max-width: $breakpoint-xl)
margin-bottom: -16px

&_with-input-compensation
margin-bottom: 180px
@media screen and (max-width: $breakpoint-xl)
margin-bottom: -16px

&--input-container
z-index: 10
@media screen and (min-width: $breakpoint-xl)
position: absolute
min-height: 60px
bottom: 0
left: 0
right: 0

&_sort-desc
@media screen and (max-width: $breakpoint-xl)
order: -1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<%=
component_wrapper do
render(Primer::Beta::Blankslate.new(
border: true,
data: { test_selector: "op-wp-journals-container-empty"})) do |component|
component.with_visual_icon(icon: :pulse)
component.with_heading(tag: :h2).with_content(t("activities.work_packages.activity_tab.no_results_title_text"))
component.with_description { t("activities.work_packages.activity_tab.no_results_description_text") }
end
end
%>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# frozen_string_literal: true

# -- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2023 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
# ++

module WorkPackages
module ActivitiesTab
module Journals
class EmptyComponent < ApplicationComponent
include ApplicationHelper
include OpPrimer::ComponentHelpers
include OpTurbo::Streamable
end
end
end
end
Loading

0 comments on commit 6995413

Please sign in to comment.