Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…awa-admin into setup-script
  • Loading branch information
disha1202 committed Jan 18, 2024
2 parents 42a3318 + c627166 commit 2464e86
Show file tree
Hide file tree
Showing 14 changed files with 730 additions and 157 deletions.
6 changes: 5 additions & 1 deletion public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,11 @@
"deleteAdvertisement": "Delete Advertisement",
"deleteAdvertisementMsg": "Do you want to remove this advertisement?",
"no": "No",
"yes": "Yes"
"yes": "Yes",
"view": "View",
"edit": "Edit",
"editAdvertisement": "Edit Advertisement",
"saveChanges": "Save Changes"
},
"userChat": {
"chat": "Chat",
Expand Down
6 changes: 5 additions & 1 deletion public/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,11 @@
"deleteAdvertisement": "Supprimer l'annonce",
"deleteAdvertisementMsg": "Voulez-vous supprimer cette annonce ?",
"no": "Non",
"yes": "Oui"
"yes": "Oui",
"view": "Voir",
"edit": "Éditer",
"editAdvertisement": "Éditer l'annonce",
"saveChanges": "Enregistrer les modifications"
},
"userChat": {
"chat": "Chat",
Expand Down
6 changes: 5 additions & 1 deletion public/locales/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,11 @@
"deleteAdvertisement": "विज्ञापन हटाएं",
"deleteAdvertisementMsg": "क्या आप इस विज्ञापन को हटाना चाहते हैं?",
"no": "नहीं",
"yes": "हाँ"
"yes": "हाँ",
"view": "देखें",
"edit": "संपादित करें",
"editAdvertisement": "विज्ञापन संपादित करें",
"saveChanges": "परिवर्तन सहेजें"
},
"userChat": {
"chat": "बात",
Expand Down
6 changes: 5 additions & 1 deletion public/locales/sp.json
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,11 @@
"deleteAdvertisement": "Eliminar anuncio",
"deleteAdvertisementMsg": "¿Desea eliminar este anuncio?",
"no": "No",
"yes": ""
"yes": "",
"view": "Ver",
"edit": "Editar",
"editAdvertisement": "Editar Anuncio",
"saveChanges": "Guardar Cambios"
},
"userChat": {
"chat": "Charlar",
Expand Down
6 changes: 5 additions & 1 deletion public/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,11 @@
"deleteAdvertisement": "删除广告",
"deleteAdvertisementMsg": "您是否要删除此广告?",
"no": "",
"yes": ""
"yes": "",
"view": "查看",
"edit": "编辑",
"editAdvertisement": "编辑广告",
"saveChanges": "保存更改"
},
"userChat": {
"chat": "聊天",
Expand Down
25 changes: 25 additions & 0 deletions src/GraphQl/Mutations/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,31 @@ export const ADD_ADVERTISEMENT_MUTATION = gql`
}
}
`;
export const UPDATE_ADVERTISEMENT_MUTATION = gql`
mutation UpdateAdvertisement(
$id: ID!
$name: String
$link: String
$type: AdvertisementType
$startDate: Date
$endDate: Date
) {
updateAdvertisement(
input: {
_id: $id
name: $name
link: $link
type: $type
startDate: $startDate
endDate: $endDate
}
) {
advertisement {
_id
}
}
}
`;
export const DELETE_ADVERTISEMENT_BY_ID = gql`
mutation ($id: ID!) {
deleteAdvertisementById(id: $id) {
Expand Down
51 changes: 0 additions & 51 deletions src/components/Advertisements/Advertisements.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,57 +163,6 @@ const ORGANIZATIONS_LIST_MOCK = {
};

describe('Testing Advertisement Component', () => {
test('Testing if the deletion works', async () => {
const mocks = [
{
request: {
query: ADVERTISEMENTS_GET,
},
result: {
data: {
getAdvertisements: [
{
_id: '1',
name: 'Advertisement1',
type: 'POPUP',
orgId: 'undefined',
link: 'http://example1.com',
endDate: '2023-01-01',
startDate: '2022-01-01',
},
],
},
loading: false,
},
},
ORGANIZATIONS_LIST_MOCK,
PLUGIN_GET_MOCK,
ADD_ADVERTISEMENT_MUTATION_MOCK,
];

render(
<MockedProvider addTypename={false} mocks={mocks}>
<BrowserRouter>
<Provider store={store}>
<I18nextProvider i18n={i18nForTest}>
<ToastContainer />
<Advertisement />
</I18nextProvider>
</Provider>
</BrowserRouter>
</MockedProvider>
);

await wait();

await act(async () => {
await userEvent.click(screen.getByText('Delete'));
});
await act(async () => {
await userEvent.click(screen.getByText('Yes'));
});
});

test('for creating new Advertisements', async () => {
const mocks = [
ORGANIZATIONS_LIST_MOCK,
Expand Down
1 change: 1 addition & 0 deletions src/components/Advertisements/Advertisements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ export default function advertisements(): JSX.Element {
orgId={ad.orgId}
startDate={new Date(ad.startDate)}
endDate={new Date(ad.endDate)}
link={ad.link}
// getInstalledPlugins={getInstalledPlugins}
/>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,67 @@
}

.entryaction {
margin-left: auto;
display: flex !important;
align-items: center;
}

.entryaction i {
margin-right: 8px;
margin-top: 4px;
}

.entryaction .spinner-grow {
height: 1rem;
width: 1rem;
margin-right: 8px;
}

.buttons {
display: flex;
justify-content: flex-end;
}

.dropdownButton {
background-color: transparent;
color: #000;
border: none;
cursor: pointer;
display: flex;
width: 100%;
justify-content: flex-end;
padding: 8px 10px;
}

.dropdownContainer {
position: relative;
display: inline-block;
}

.dropdownmenu {
display: none;
position: absolute;
z-index: 1;
background-color: white;
width: 120px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
padding: 5px 0;
margin: 0;
list-style-type: none;
right: 0;
top: 100%;
}

.dropdownmenu li {
cursor: pointer;
padding: 8px 16px;
text-decoration: none;
display: block;
color: #333;
}

.dropdownmenu li:hover {
background-color: #f1f1f1;
}

.dropdownContainer:hover .dropdownmenu {
display: block;
}
Loading

0 comments on commit 2464e86

Please sign in to comment.