Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function TenantSelector() {
return (
<Nav.Item className="text-white mb-2 mt-4">
<div className="text-white">{t("tenant")}</div>
<div className="text-white fw-bold">
<div className="text-white fw-bold me-3">
{tenants && (
<>
{tenants.length === 1 && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function ContactForm({
target: { id: `${name}.${index}.image`, value: target.value },
});
}}
acceptedMimetypes={["image/*"]}
acceptedMimetypes={{"image/*": []}}
multiple={false}
name="image"
/>
Expand Down
6 changes: 3 additions & 3 deletions assets/admin/components/slide/content/content-form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function ContentForm({
*/
function renderElement(formData) {
let returnElement;
let defaultMimetypes = null;
let defaultMimetypes = {};
switch (formData.input) {
case "checkbox-options":
returnElement = (
Expand All @@ -64,9 +64,9 @@ function ContentForm({
case "video":
case "file":
if (formData.input === "image") {
defaultMimetypes = ["image/*"];
defaultMimetypes["image/*"] = [];
} else if (formData.input === "video") {
defaultMimetypes = ["video/*"];
defaultMimetypes["video/*"] = [];
}

returnElement = (
Expand Down
2 changes: 1 addition & 1 deletion assets/admin/components/slide/content/file-selector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function FileSelector({
const renderFileFormElements = (fileEntries) =>
fileEntries.map((fileEntry) => (
<div
key={fileEntry["@id"]}
key={fileEntry["@id"] || fileEntry.tempId}
className="bg-light border p-3 pb-0 rounded my-3"
>
<FileFormElement
Expand Down
60 changes: 19 additions & 41 deletions assets/admin/components/util/paginate/pagination.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useTranslation } from "react-i18next";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import ReactPaginate from "react-paginate";
import { faAngleLeft, faAngleRight } from "@fortawesome/free-solid-svg-icons";

/**
Expand All @@ -17,49 +16,28 @@ function Pagination({ itemsCount, pageSize, onPageChange, currentPage }) {
// No need for pagination
if (pageCount <= 1) return null;

/**
* A function to align pagination data with the data we need, our pages are
* not 0-indexed.
*
* @param {object} props - The props.
* @param {Array} props.selected The selected page
*/
const changePage = ({ selected }) => {
onPageChange(selected + 1);
const nextPage = () => {
onPageChange(currentPage + 1);
};

const prevPage = () => {
onPageChange(Math.max(1, currentPage - 1));
};

return (
<ReactPaginate
breakLabel="..."
nextLabel={
<FontAwesomeIcon
aria-label={t("pagination-next")}
icon={faAngleRight}
/>
}
pageCount={Math.ceil(itemsCount / pageSize)}
previousLabel={
<FontAwesomeIcon
aria-label={t("pagination-previous")}
icon={faAngleLeft}
/>
}
renderOnZeroPageCount={null}
onPageChange={changePage}
pageClassName="page-item"
pageLinkClassName="page-link"
previousClassName="page-item"
previousLinkClassName="page-link"
nextClassName="page-item"
nextLinkClassName="page-link"
breakClassName="page-item"
breakLinkClassName="page-link"
containerClassName="pagination"
pageRangeDisplayed={3}
marginPagesDisplayed={2}
activeClassName="active"
forcePage={currentPage - 1}
/>
<div className="d-flex justify-content-center">
{currentPage > 1 && (
<a type="button" className="me-3" onClick={() => prevPage()}>
{t("prev")}
</a>
)}
<span className="me-3">{t("page", { currentPage: currentPage })}</span>
{currentPage * pageSize < itemsCount && (
<a type="button" className="me-3" onClick={() => nextPage()}>
{t("next")}
</a>
)}
</div>
);
}

Expand Down
5 changes: 3 additions & 2 deletions assets/admin/translations/da/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -666,8 +666,9 @@
}
},
"pagination": {
"pagination-previous": "Tidligere",
"pagination-next": "Næste"
"prev": "←",
"next": "→",
"page": "Side {{currentPage}}"
},
"search-box": {
"search-box-aria-label": "Søg",
Expand Down
2 changes: 1 addition & 1 deletion assets/client/util/app-storage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import jwtDecode from "jwt-decode";
import { jwtDecode } from "jwt-decode";
import localStorageKeys from "./local-storage-keys";

class AppStorage {
Expand Down
Loading
Loading