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

Feature: add merge campaigns UI #7612

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
22fda3e
feature: add default form action to list view
glaubersilva Nov 5, 2024
c9c84ea
refactor: add support to isDefaultCampaignForm key
glaubersilva Nov 5, 2024
e09ee33
refactor: update route
glaubersilva Nov 5, 2024
8552486
refactor: remove unnecessary endpoint
glaubersilva Nov 6, 2024
b9492c9
fix: default form logic
glaubersilva Nov 6, 2024
128b499
Merge branch 'epic/campaigns' into feature/list-view-change-default-f…
glaubersilva Nov 6, 2024
25e5d5b
Merge branch 'epic/campaigns' into feature/merge-capmpaign-UI-GIVE-14…
glaubersilva Nov 6, 2024
aa88aff
feature: add merge modal and initial form
glaubersilva Nov 7, 2024
4c20244
Merge branch 'feature/list-view-change-default-form-GIVE-1333' into f…
glaubersilva Nov 7, 2024
0403c0e
refactor: change logic to open and close merge modal
glaubersilva Nov 7, 2024
ca24fa1
Merge branch 'feature/merge-capmpaign-UI-GIVE-1402-GIVE-1405' of gith…
glaubersilva Nov 7, 2024
56f577e
feature: setup merge campaigns endpoint
glaubersilva Nov 7, 2024
b499fc7
feature: add notice and step 4
glaubersilva Nov 7, 2024
9cd0951
feature: add styles for steps 1 and 2
glaubersilva Nov 7, 2024
abc4a33
feature: add styles for steps 3 and 4
glaubersilva Nov 7, 2024
93a50e3
feature: clear list table after the merge
glaubersilva Nov 7, 2024
42b9f02
refactor: change button actions
glaubersilva Nov 7, 2024
833b734
refactor: change button styles
glaubersilva Nov 7, 2024
0e9ec30
chore: remove unnecessary code
glaubersilva Nov 7, 2024
bc76d26
chore: remove commented code
glaubersilva Nov 7, 2024
701ffee
Merge branch 'epic/campaigns' into feature/list-view-change-default-f…
glaubersilva Nov 7, 2024
15d42fd
Merge branch 'feature/list-view-change-default-form-GIVE-1333' into f…
glaubersilva Nov 7, 2024
68a8f99
refactor: return null
glaubersilva Nov 8, 2024
97ca2e9
refactor: remove getFormModalTitle function
glaubersilva Nov 8, 2024
bb5bee9
refactor: replace null = null with null
glaubersilva Nov 8, 2024
9343b02
Merge branch 'epic/campaigns' into feature/merge-capmpaign-UI-GIVE-14…
glaubersilva Nov 8, 2024
5223c88
refactor: move logic to confirm method
glaubersilva Nov 8, 2024
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
6 changes: 3 additions & 3 deletions src/Campaigns/ListTable/CampaignsListTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
use Give\Campaigns\ListTable\Columns\DonationsCountColumn;
use Give\Campaigns\ListTable\Columns\GoalColumn;
use Give\Campaigns\ListTable\Columns\IdColumn;
use Give\Campaigns\ListTable\Columns\NameColumn;
use Give\Campaigns\ListTable\Columns\RevenueColumn;
use Give\Campaigns\ListTable\Columns\StatusColumn;
use Give\Campaigns\ListTable\Columns\TitleColumn;
use Give\Framework\ListTable\ListTable;
use Give\Framework\ListTable\ModelColumn;

Expand All @@ -34,7 +34,7 @@ protected function getDefaultColumns(): array
// TODO We need to decide which columns should be displayed
return [
new IdColumn(),
new NameColumn(),
new TitleColumn(),
new GoalColumn(),
new DonationsCountColumn(),
new RevenueColumn(),
Expand All @@ -55,7 +55,7 @@ protected function getDefaultVisibleColumns(): array
{
return [
IdColumn::getId(),
NameColumn::getId(),
TitleColumn::getId(),
GoalColumn::getId(),
DonationsCountColumn::getId(),
RevenueColumn::getId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
/**
* @unreleased
*/
class NameColumn extends ModelColumn
class TitleColumn extends ModelColumn
{
protected $sortColumn = 'name';
protected $sortColumn = 'title';

/**
* @unreleased
*/
public static function getId(): string
{
return 'name';
return 'title';
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {CampaignsRowActions} from './CampaignsRowActions';
import styles from './CampaignsListTable.module.scss';
import {GiveCampaignsListTable} from './types';
import CreateCampaignModal from '../CreateCampaignModal';
import MergeCampaignModal from '../MergeCampaign/Modal';

declare const window: {
GiveCampaignsListTable: GiveCampaignsListTable;
Expand Down Expand Up @@ -90,6 +91,25 @@ const bulkActions: Array<BulkActionsConfig> = [
</>
),
},
{
label: __('Merge', 'give'),
value: 'merge',
type: 'urlAction',
action: async (selected) => {
return await new Promise((resolve) => setTimeout(resolve, 0));
},
confirm: (selected, names) => {
const urlParams = new URLSearchParams(window.location.search);
urlParams.set('action', 'merge');
window.history.replaceState(
{selected: selected, names: names},
__('Merge Campaings', 'give'),
`${window.location.pathname}?${urlParams.toString()}`
);

return null;
},
},
];

/**
Expand Down Expand Up @@ -134,6 +154,7 @@ export default function CampaignsListTable() {
listTableBlankSlate={ListTableBlankSlate()}
>
<CreateCampaignModal />
<MergeCampaignModal />
</ListTablePage>
</>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
.campaignForm {

.intro {
font-size: 1rem;
color: #4b5563;
align-self: stretch;
padding: 0 1.25rem 0 0.625rem;
margin: unset;
}

.submitButton {
border-radius: 0;
font-size: 0.875rem;
font-weight: 600;
line-height: 1.43;
padding: var(--givewp-spacing-2) var(--givewp-spacing-4);
text-align: center;
}

label {
font-size: 1rem;
}

input,
select,
textarea {
font-size: 1rem;
line-height: 2;
display: block;
width: 100%;
border: 1px solid #9ca0af;
border-radius: var(--givewp-spacing-1);
padding: var(--givewp-spacing-2);
}

select {
max-width: 100%;
}

.description {
font-size: 0.875rem;
margin-bottom: 0.4rem;
}

.notice {
display: flex;
margin: 1rem 0 -0.2rem 0;
gap: 0.3rem;
padding: 0 0.5rem 0 0.5rem;
background-color: var(--givewp-blue-25);
border-radius: 4px;
border: 1px solid var(--givewp-blue-400);
border-left-width: 4px;
font-size: 0.875rem;
font-weight: 500;
color: #1a0f00;

svg {
margin: 0.7rem 0.3rem;
height: 1.25rem;
width: 1.25rem;
}
}

.returnMessage {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
gap: 1.5rem;

span {
margin: -1rem 3rem 1rem 3rem;
}
}
}

.fieldRequired {
color: var(--givewp-red-500);
}

.button:is(:global(.button)) {
border-radius: var(--givewp-rounded-8)
}

.previousButton:is(:global(.button)) {
background-color: transparent;
border: solid 1px #9ca0af;
color: #060c1a;

&:hover {
border: solid 1px #9ca0af;
color: #060c1a;
}
}
Loading
Loading