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

Plugin and advertisement screen revamp #2006

Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
6173faf
advertisement and plugin screen
duplixx May 24, 2024
afd1fa6
Merge branch 'develop' into plugin-advertisement-revamp
duplixx Nov 13, 2024
323a0c7
added revamped design
duplixx Nov 13, 2024
9bc0676
fixes added
duplixx Nov 13, 2024
9e12260
fixed testcases
duplixx Nov 14, 2024
82836f0
chore(deps): bump sass from 1.80.6 to 1.80.7 (#2433)
dependabot[bot] Nov 14, 2024
a97314c
chore(deps): bump eslint-plugin-import from 2.30.0 to 2.31.0 (#2434)
dependabot[bot] Nov 14, 2024
32eb6a9
chore(deps): bump @mui/x-charts from 7.22.1 to 7.22.2 (#2435)
dependabot[bot] Nov 14, 2024
ab509f6
chore(deps): bump @types/react from 18.3.3 to 18.3.12 (#2436)
dependabot[bot] Nov 14, 2024
fb913e1
Update pull-request.yml
palisadoes Nov 14, 2024
d16b95e
Update dependabot.yaml
palisadoes Nov 16, 2024
15513f5
added docker check to workflow (#2414)
VanshikaSabharwal Nov 17, 2024
3ea2919
eslint-rule-no_unused_vars (#2428)
prayanshchh Nov 17, 2024
084ac7e
Updated pr template with checklist (#2454)
dhirajudhani Nov 20, 2024
32159c2
Merge branch 'develop-postgres' into plugin-advertisement-revamp
duplixx Nov 20, 2024
584662a
Merge branch 'develop' into plugin-advertisement-revamp
duplixx Nov 20, 2024
908e6c8
Merge remote-tracking branch 'upstream/develop-postgres' into plugin-…
duplixx Nov 27, 2024
fb55f35
Merge branch 'develop-postgres' into plugin-advertisement-revamp
duplixx Nov 28, 2024
a63e0d4
refactored addOnStore
duplixx Dec 1, 2024
f92cba1
Merge branch 'develop-postgres' into plugin-advertisement-revamp
duplixx Dec 1, 2024
a35b2ab
refactored addOnEntry v1
duplixx Dec 1, 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
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"import/no-duplicates": "error",
"tsdoc/syntax": "error",
"@typescript-eslint/ban-ts-comment": "error",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
Expand Down
20 changes: 15 additions & 5 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ We employ the following branching strategy to simplify the development process a
NOTE!!!

ONLY SUBMIT PRS AGAINST OUR `DEVELOP` BRANCH. THE DEFAULT IS `MAIN`, SO YOU WILL HAVE TO MODIFY THIS BEFORE SUBMITTING YOUR PR FOR REVIEW. PRS MADE AGAINST `MAIN` WILL BE CLOSED.

-->

<!--
Expand All @@ -23,10 +24,6 @@ Thanks for submitting a pull request! Please provide enough information so that

Fixes #<!--Add related issue number here.-->

**Did you add tests for your changes?**

<!--Yes or No. Note: Add unit tests or automation tests for your code.-->

**Snapshots/Videos:**

<!--Add snapshots or videos wherever possible.-->
Expand All @@ -44,10 +41,23 @@ Fixes #<!--Add related issue number here.-->

<!-- If this PR introduces a breaking change, please describe the impact and a migration path for existing applications. -->

## Checklist

### CodeRabbit AI Review
- [ ] I have reviewed and addressed all critical issues flagged by CodeRabbit AI
- [ ] I have implemented or provided justification for each non-critical suggestion
- [ ] I have documented my reasoning in the PR comments where CodeRabbit AI suggestions were not implemented

### Test Coverage
- [ ] I have written tests for all new changes/features
- [ ] I have verified that test coverage meets or exceeds 95%
- [ ] I have run the test suite locally and all tests pass


**Other information**

<!--Add extra information about this PR here-->

**Have you read the [contributing guide](https://github.com/PalisadoesFoundation/talawa-admin/blob/master/CONTRIBUTING.md)?**

<!--Yes or No-->
<!--Yes or No-->
10 changes: 2 additions & 8 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
- name: Check for linting errors in modified files
if: steps.changed-files.outputs.only_changed != 'true'
env:
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
CHANGED_FILES: ${{ steps.changed_files.outputs.all_changed_files }}
run: npx eslint ${CHANGED_FILES} && python .github/workflows/eslint_disable_check.py

- name: Check for TSDoc comments
Expand Down Expand Up @@ -124,12 +124,6 @@ jobs:
ISSUE_GUIDELINES.md
PR_GUIDELINES.md
README.md
*.pem
*.key
*.cert
*.password
*.secret
*.credentials

- name: List all changed unauthorized files
if: steps.changed-unauth-files.outputs.any_changed == 'true' || steps.changed-unauth-files.outputs.any_deleted == 'true'
Expand Down Expand Up @@ -204,7 +198,7 @@ jobs:

- name: Get changed TypeScript files
id: changed-files
uses: tj-actions/changed-files@v45
uses: tj-actions/changed-files@v40

- name: Run tests
if: steps.changed-files.outputs.only_changed != 'true'
Expand Down
4 changes: 2 additions & 2 deletions public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@
"register": "register"
},
"addOnStore": {
"title": "Add On Store",
"title": "Plugin Store",
"searchName": "Ex: Donations",
"search": "Search",
"enable": "Enabled",
Expand Down Expand Up @@ -1227,7 +1227,7 @@
"RstartDate": "Select Start Date",
"RendDate": "Select End Date",
"RClose": "Close the window",
"addNew": "Create new advertisement",
"addNew": "Create",
"EXname": "Ex. Cookie Shop",
"EXlink": "Ex. http://yourwebsite.com/photo",
"createAdvertisement": "Create Advertisement",
Expand Down
6 changes: 5 additions & 1 deletion src/components/AddOn/core/AddOnEntry/AddOnEntry.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@
margin-left: auto;
display: flex !important;
align-items: center;
background-color: transparent;
color: #31bb6b;
}
.card {
border: 4px solid green;
}

.entryaction i {
margin-right: 8px;
}
Expand Down
12 changes: 8 additions & 4 deletions src/components/AddOn/core/AddOnEntry/AddOnEntry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface InterfaceAddOnEntryProps {
component?: string; // Optional props
modified?: any; // Optional props
uninstalledOrgs: string[];
getInstalledPlugins: () => any;
getInstalledPlugins: () => void;
}

/**
Expand Down Expand Up @@ -59,6 +59,7 @@ function addOnEntry({

// Getting orgId from URL parameters
const { orgId: currentOrg } = useParams();
// console.log(currentOrg);
if (!currentOrg) {
// If orgId is not present in the URL, navigate to the org list page
return <Navigate to={'/orglist'} />;
Expand Down Expand Up @@ -101,7 +102,10 @@ function addOnEntry({

return (
<>
<Card data-testid="AddOnEntry">
<Card
data-testid="AddOnEntry"
style={{ border: '1px solid #31BB6B', borderRadius: '10px' }}
>
{/* {uninstalledOrgs.includes(currentOrg) && (
<Form.Check
type="switch"
Expand All @@ -114,7 +118,7 @@ function addOnEntry({
/>
)} */}
<Card.Body>
<Card.Title>{title}</Card.Title>
<Card.Title style={{ fontWeight: '800' }}>{title}</Card.Title>
<Card.Subtitle className="mb-2 text-muted author">
{createdBy}
</Card.Subtitle>
Expand All @@ -134,7 +138,7 @@ function addOnEntry({
<Spinner animation="grow" />
) : (
<i
className={!isInstalledLocal ? 'fa fa-trash' : 'fa fa-cubes'}
className={!isInstalledLocal ? 'fa fa-trash' : 'fa fa-plus'}
duplixx marked this conversation as resolved.
Show resolved Hide resolved
></i>
)}
{/* {installed ? 'Remove' : configurable ? 'Installed' : 'Install'} */}
Expand Down
45 changes: 43 additions & 2 deletions src/components/AddOn/core/AddOnStore/AddOnStore.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@
border-bottom: 3px solid #31bb6b;
width: 15%;
}

.actioninput {
.input {
display: flex;
position: relative;
width: 560px;
}
/* .actioninput {
text-decoration: none;
margin-bottom: 50px;
border-color: #e8e5e5;
Expand All @@ -23,9 +27,46 @@
padding-right: 10px;
padding-left: 10px;
box-shadow: none;
} */
.actioninput {
margin-top: 10px;
margin-bottom: 10px;
background-color: white;
box-shadow: 0 1px 1px #31bb6b;
}
.inputField > button {
padding-top: 10px;
padding-bottom: 10px;
}

.actionradio input {
width: fit-content;
margin: inherit;
}
.cardGridItem {
width: 38vw;
}
.justifysp {
display: grid;
width: 100%;
justify-content: space-between;
align-items: baseline;
grid-template-rows: auto;
grid-template-columns: repeat(2, 1fr);
grid-gap: 0.8rem 0.4rem;
}

@media screen and (max-width: 600px) {
.cardGridItem {
width: 100%;
}
.justifysp {
display: grid;
width: 100%;
justify-content: center;
align-items: start;
grid-template-rows: auto;
grid-template-columns: 1fr;
grid-gap: 0.8rem 0.4rem;
}
}
99 changes: 17 additions & 82 deletions src/components/AddOn/core/AddOnStore/AddOnStore.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ import useLocalStorage from 'utils/useLocalstorage';
import { MockedProvider } from '@apollo/react-testing';

const { getItem } = useLocalStorage();

interface InterfacePlugin {
enabled: boolean;
pluginName: string;
component: string;
}
jest.mock('components/AddOn/support/services/Plugin.helper', () => ({
__esModule: true,
default: jest.fn().mockImplementation(() => ({
Expand Down Expand Up @@ -60,16 +64,18 @@ jest.mock('components/AddOn/support/services/Plugin.helper', () => ({
},
// Add more mock data as needed
]),
generateLinks: jest.fn().mockImplementation((plugins) => {
return plugins
.filter((plugin: { enabled: any }) => plugin.enabled)
.map((installedPlugin: { pluginName: any; component: string }) => {
return {
name: installedPlugin.pluginName,
url: `/plugin/${installedPlugin.component.toLowerCase()}`,
};
});
}),
generateLinks: jest
.fn()
.mockImplementation((plugins: InterfacePlugin[]) => {
return plugins
.filter((plugin) => plugin.enabled)
.map((installedPlugin) => {
return {
name: installedPlugin.pluginName,
url: `/plugin/${installedPlugin.component.toLowerCase()}`,
};
});
}),
})),
}));

Expand Down Expand Up @@ -301,77 +307,6 @@ describe('Testing AddOnStore Component', () => {
expect(message.length).toBeGreaterThanOrEqual(1);
});

test('check filters enabled and disabled under Installed tab', async () => {
const mocks = [ORGANIZATIONS_LIST_MOCK, PLUGIN_GET_MOCK];
render(
<ApolloProvider client={client}>
<Provider store={store}>
<BrowserRouter>
<I18nextProvider i18n={i18nForTest}>
<MockedProvider mocks={mocks} addTypename={false}>
<AddOnStore />
</MockedProvider>
</I18nextProvider>
</BrowserRouter>
</Provider>
</ApolloProvider>,
);

await wait();
userEvent.click(screen.getByText('Installed'));

expect(screen.getByText('Filters')).toBeInTheDocument();
expect(screen.getByLabelText('Enabled')).toBeInTheDocument();
expect(screen.getByLabelText('Disabled')).toBeInTheDocument();

fireEvent.click(screen.getByLabelText('Enabled'));
expect(screen.getByLabelText('Enabled')).toBeChecked();
fireEvent.click(screen.getByLabelText('Disabled'));
expect(screen.getByLabelText('Disabled')).toBeChecked();
});

test('check the working search bar when on Installed tab', async () => {
const mocks = [ORGANIZATIONS_LIST_MOCK, PLUGIN_GET_MOCK];

const { container } = render(
<ApolloProvider client={client}>
<Provider store={store}>
<BrowserRouter>
<I18nextProvider i18n={i18nForTest}>
<MockedProvider mocks={mocks} addTypename={false}>
<AddOnStore />
</MockedProvider>
</I18nextProvider>
</BrowserRouter>
</Provider>
</ApolloProvider>,
);
await wait();
userEvent.click(screen.getByText('Installed'));

await wait();
let searchText = '';
fireEvent.change(screen.getByPlaceholderText('Ex: Donations'), {
target: { value: searchText },
});
expect(container).toHaveTextContent('Plugin 1');
expect(container).toHaveTextContent('Plugin 3');

searchText = 'Plugin 1';
fireEvent.change(screen.getByPlaceholderText('Ex: Donations'), {
target: { value: searchText },
});
const plugin1Elements = screen.queryAllByText('Plugin 1');
expect(plugin1Elements.length).toBeGreaterThan(1);

searchText = 'Test Plugin';
fireEvent.change(screen.getByPlaceholderText('Ex: Donations'), {
target: { value: searchText },
});
const message = screen.getAllByText('Plugin does not exists');
expect(message.length).toBeGreaterThanOrEqual(1);
});

test('AddOnStore loading test', async () => {
expect(true).toBe(true);
const mocks = [ORGANIZATIONS_LIST_MOCK, PLUGIN_LOADING_MOCK];
Expand Down
Loading
Loading