Skip to content

Commit

Permalink
Merge pull request #739 from danskernesdigitalebibliotek/develop
Browse files Browse the repository at this point in the history
Get latest develop changes
  • Loading branch information
spaceo authored Dec 5, 2023
2 parents a70812f + d2642ff commit 4e3d883
Show file tree
Hide file tree
Showing 40 changed files with 632 additions and 459 deletions.
30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@
"post-process-generated-graphql": "ts-node ./scripts/post-process-generated-graphql.ts"
},
"devDependencies": {
"@babel/core": "^7.23.3",
"@babel/core": "^7.23.5",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-optional-chaining": "^7.21.0",
"@babel/preset-env": "^7.23.3",
"@babel/preset-env": "^7.23.5",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@csstools/postcss-sass": "^5.0.1",
"@cypress/browserify-preprocessor": "^3.0.2",
"@cypress/code-coverage": "^3.12.10",
"@cypress/code-coverage": "^3.12.12",
"@graphql-codegen/add": "^3.1.1",
"@graphql-codegen/cli": "^2.6.2",
"@graphql-codegen/introspection": "^2.1.1",
Expand All @@ -71,25 +71,25 @@
"@storybook/manager-webpack5": "^6.5.0-beta.7",
"@storybook/preset-typescript": "^3.0.0",
"@storybook/react": "^6.5.0-beta.7",
"@testing-library/dom": "^9.3.0",
"@testing-library/dom": "^9.3.3",
"@testing-library/react": "^14.1.2",
"@testing-library/react-hooks": "^8.0.1",
"@tsconfig/create-react-app": "^1.0.2",
"@types/node": "^20.8.9",
"@types/react": "^18.2.37",
"@types/node": "^20.10.3",
"@types/react": "^18.2.41",
"@types/react-dom": "^18.2.7",
"@types/react-redux": "^7.1.24",
"@typescript-eslint/eslint-plugin": "^5.23.0",
"@typescript-eslint/parser": "^5.23.0",
"@typescript-eslint/parser": "^6.13.1",
"@vitest/coverage-istanbul": "^0.34.6",
"autoprefixer": "^10.4.16",
"babel-loader": "^9.1.3",
"babel-plugin-istanbul": "^6.1.1",
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"caniuse-lite": "^1.0.30001563",
"caniuse-lite": "^1.0.30001566",
"chokidar-cli": "^3.0.0",
"concurrently": "^7.1.0",
"concurrently": "^8.2.2",
"core-js": "^3.33.3",
"css-loader": "^6.8.1",
"cssnano": "^6.0.1",
Expand All @@ -115,13 +115,13 @@
"mutationobserver-shim": "^0.3.7",
"nyc": "^15.1.0",
"orval": "^6.8.1",
"postcss": "^8.4.31",
"postcss": "^8.4.32",
"postcss-cli": "^10.1.0",
"postcss-loader": "^7.3.3",
"postcss-scss": "^4.0.9",
"prettier": "^2.6.2",
"replace-in-file": "^6.3.2",
"sass": "^1.69.0",
"sass": "^1.69.5",
"source-map-support": "^0.5.21",
"style-loader": "^3.3.3",
"stylelint": "^15.11.0",
Expand All @@ -135,7 +135,7 @@
"typescript": "^4.6.4",
"vitest": "^0.28.5",
"webpack": "^5.89.0",
"webpack-cli": "^4.9.2",
"webpack-cli": "^5.1.4",
"webpack-version-file-plugin": "^0.4.0"
},
"//dependencies": {
Expand All @@ -147,7 +147,7 @@
"@reach/alert": "^0.17.0",
"@reach/dialog": "^0.18.0",
"@reduxjs/toolkit": "^1.9.7",
"@types/lodash": "^4.14.201",
"@types/lodash": "^4.14.202",
"clsx": "^2.0.0",
"dayjs": "^1.11.10",
"downshift": "^6.1.7",
Expand All @@ -163,12 +163,12 @@
"react-error-boundary": "^3.1.4",
"react-query": "^3.39.3",
"react-redux": "^8.1.3",
"react-use": "^17.4.0",
"react-use": "^17.4.1",
"redux": "^4.2.1",
"redux-persist": "^6.0.0",
"unfetch": "^4.2.0"
},
"peerDependencies": {
"postcss": "^8.4.31"
"postcss": "^8.4.32"
}
}
3 changes: 2 additions & 1 deletion src/apps/create-patron-user-info/CreatePatron.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const CreatePatron: FC = () => {
const [cpr, setCpr] = useState<string | null>(null);
const config = useConfig();
const t = useText();
const { dashboardUrl } = useUrls();
const u = useUrls();
const dashboardUrl = u("dashboardUrl");

const { id: agencyId } = config<{
id: `${number}`;
Expand Down
5 changes: 3 additions & 2 deletions src/apps/create-patron-user-info/UserInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ export interface UserInfoProps {

const UserInfo: FC<UserInfoProps> = ({ cpr }) => {
const t = useText();
const { logoutUrl } = useUrls();
const u = useUrls();
const logoutUrl = u("logoutUrl");
const redirectOnUserCreatedUrl = u("redirectOnUserCreatedUrl");
const config = useConfig();
const formRef = useRef<HTMLFormElement>(null);
const { redirectOnUserCreatedUrl } = useUrls();
const [pin, setPin] = useState<string | null>(null);
const minAge = parseInt(config("minAgeConfig"), 10);
const [validCpr] = useState<boolean>(patronAgeValid(cpr, minAge));
Expand Down
4 changes: 3 additions & 1 deletion src/apps/dashboard/dashboard-fees/dashboard-fees.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import WarningBar from "../../loan-list/materials/utils/warning-bar";

const DashboardFees: FC = () => {
const t = useText();
const { feesPageUrl } = useUrls();
const u = useUrls();

const feesPageUrl = u("feesPageUrl");
const { data: fbsFees } = useGetFeesV2();
const [feeCount, setFeeCount] = useState<number>();
const [totalFeeAmount, setTotalFeeAmount] = useState<string>("0");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ const DashboardNotificationList: FC<DashboardNotificationListProps> = ({
columns
}) => {
const t = useText();
const u = useUrls();
const physicalLoansUrl = u("physicalLoansUrl");
const reservationsUrl = u("reservationsUrl");

const {
all: {
reservations,
Expand Down Expand Up @@ -80,7 +84,6 @@ const DashboardNotificationList: FC<DashboardNotificationListProps> = ({
reservationsReady: reservationsReadyID,
reservationsQueued: reservationsQueueID
} = getModalIds();
const { physicalLoansUrl, reservationsUrl } = useUrls();

const openLoanDetailsModal = useCallback(
(loan: LoanType) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import { useUrls } from "../../core/utils/url";
const FavoritesListMaterialComponent: FC = () => {
const t = useText();
const [materials, setMaterials] = useState<Pid[]>([]);
const { favoritesListMaterialComponentGoToListUrl } = useUrls();
const u = useUrls();
const favoritesListMaterialComponentGoToListUrl = u(
"favoritesListMaterialComponentGoToListUrl"
);

const { data } = useGetList("default");
const { collections } = (data as { collections: Pid[] }) || [];

Expand Down
4 changes: 3 additions & 1 deletion src/apps/fee-list/FeeList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import EmptyList from "../../components/empty-list/empty-list";

const FeeList: FC = () => {
const t = useText();
const u = useUrls();
const viewFeesAndCompensationRatesUrl = u("viewFeesAndCompensationRatesUrl");

const [feeDetailsModalId, setFeeDetailsModalId] = useState("");
const { open } = useModalButtonHandler();
const { modalIds } = useSelector((s: ModalIdsProps) => s.modal);
Expand All @@ -34,7 +37,6 @@ const FeeList: FC = () => {
>(null);
const [totalFeePostPaymentChange, setTotalFeePostPaymentChange] =
useState<number>(0);
const { viewFeesAndCompensationRatesUrl } = useUrls();
const [feeDetailsData, setFeeDetailsData] = useState<FeeV2[]>();

const openDetailsModalClickEvent = useCallback(
Expand Down
4 changes: 3 additions & 1 deletion src/apps/fee-list/modal/my-payment-overview-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import { useUrls } from "../../../core/utils/url";

const MyPaymentOverviewModal: FC = () => {
const t = useText();
const u = useUrls();
const paymentOverviewUrl = u("paymentOverviewUrl");
const { close } = useModalButtonHandler();
const { paymentOverviewUrl } = useUrls();

const handleClick = () => {
close("intermediate-payment-modal");
};
Expand Down
3 changes: 2 additions & 1 deletion src/apps/fee-list/stackable-fees/AcceptTermsCheckbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ const AcceptTermsCheckbox: FC<AcceptTermsCheckboxProps> = ({
handleAcceptedTerms
}) => {
const t = useText();
const { termsOfTradeUrl } = useUrls();
const u = useUrls();
const termsOfTradeUrl = u("termsOfTradeUrl");

return (
<CheckBox
Expand Down
3 changes: 2 additions & 1 deletion src/apps/fee-list/stackable-fees/fee-details-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ export interface FeeDetailsContentProps {

const FeeDetailsContent: FC<FeeDetailsContentProps> = ({ feeDetailsData }) => {
const t = useText();
const u = useUrls();
const paymentOverviewUrl = u("paymentOverviewUrl");
const [check, setCheck] = useState(false);
const { paymentOverviewUrl } = useUrls();
const handleAcceptedTerms = () => {
setCheck(!check);
};
Expand Down
4 changes: 3 additions & 1 deletion src/apps/fee-list/stackable-fees/total-payment-pay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ const TotalPaymentPay: FC<TotalPaymentPayProps> = ({
totalText,
hideCheckbox
}) => {
const { availablePaymentTypesUrl } = useUrls();
const t = useText();
const u = useUrls();
const availablePaymentTypesUrl = u("availablePaymentTypesUrl");

const { open } = useModalButtonHandler();

const [check, setCheck] = useState(hideCheckbox);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ const MaterialOverdueLink: FC<MaterialOverdueLinkProps> = ({
dueDate,
showOn
}) => {
const { viewFeesAndCompensationRatesUrl } = useUrls();
const t = useText();
const u = useUrls();
const viewFeesAndCompensationRatesUrl = u("viewFeesAndCompensationRatesUrl");

if (!dueDate || (dueDate && !materialIsOverdue(dueDate))) return null;

return (
Expand Down
4 changes: 3 additions & 1 deletion src/apps/loan-list/modal/material-details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ const MaterialDetails: FC<MaterialDetailsProps & MaterialProps> = ({
>(null);

const t = useText();
const { ereolenMyPageUrl, viewFeesAndCompensationRatesUrl } = useUrls();
const u = useUrls();
const ereolenMyPageUrl = u("ereolenMyPageUrl");
const viewFeesAndCompensationRatesUrl = u("viewFeesAndCompensationRatesUrl");

if (!loan) {
return null;
Expand Down
9 changes: 6 additions & 3 deletions src/apps/menu/menu-logged-in/MenuLoggedInContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ interface MenuLoggedInContentProps {
}

const MenuLoggedInContent: FC<MenuLoggedInContentProps> = ({ pageSize }) => {
const t = useText();
const u = useUrls();
const userProfileUrl = u("userProfileUrl");
const logoutUrl = u("logoutUrl");
const config = useConfig();

const {
all: { reservations }
} = useReservations();
Expand All @@ -27,8 +33,6 @@ const MenuLoggedInContent: FC<MenuLoggedInContentProps> = ({ pageSize }) => {
} = useLoans();
const { data: patronData } = usePatronData();
const { data: fbsFees } = useGetFeesV2();
const t = useText();
const config = useConfig();

// Get menu navigation data from config.
const menuNavigationData = config<MenuNavigationDataType[]>(
Expand All @@ -41,7 +45,6 @@ const MenuLoggedInContent: FC<MenuLoggedInContentProps> = ({ pageSize }) => {
AuthenticatedPatronV6 | null | undefined
>();
const [feeCount, setFeeCount] = useState<number>(0);
const { userProfileUrl, logoutUrl } = useUrls();

// Set user data
useEffect(() => {
Expand Down
5 changes: 4 additions & 1 deletion src/apps/menu/menu-not-logged-in/menu-not-logged-in.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import { getModalIds } from "../../../core/utils/helpers/modal-helpers";

const MenuNotLoggedInContent: FC = () => {
const t = useText();
const { menuLoginUrl, menuSignUpUrl } = useUrls();
const u = useUrls();
const menuLoginUrl = u("menuLoginUrl");
const menuSignUpUrl = u("menuSignUpUrl");

const { userMenuAnonymous: userMenuAnonymousModalId } = getModalIds();

return (
Expand Down
8 changes: 8 additions & 0 deletions src/apps/menu/menu.dev.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ export default {
defaultValue: "/Logout",
control: { type: "text" }
},
physicalLoansUrl: {
defaultValue: "/user/me/loans",
control: { type: "text" }
},
reservationsUrl: {
defaultValue: "/user/me/reservations",
control: { type: "text" }
},
menuLoginText: {
defaultValue: "Log in",
control: { type: "text" }
Expand Down
2 changes: 2 additions & 0 deletions src/apps/menu/menu.entry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export interface MenuProps {
menuAuthenticatedCloseButtonText: string;
menuAuthenticatedModalDescriptionText: string;
menuNotAuthenticatedModalDescriptionText: string;
physicalLoansUrl: string;
reservationsUrl: string;
}

export interface MenuEntryProps
Expand Down
4 changes: 3 additions & 1 deletion src/apps/patron-page/PatronPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ import { getModalIds } from "../../core/utils/helpers/modal-helpers";
const PatronPage: FC = () => {
const queryClient = useQueryClient();
const t = useText();
const u = useUrls();
const deletePatronUrl = u("deletePatronUrl");

const { mutate } = useUpdateV5();
const { pauseReservation } = getModalIds();

const { data: patronData } = usePatronData();

const { deletePatronUrl } = useUrls();
const [patron, setPatron] = useState<PatronV5 | null>(null);
const [pin, setPin] = useState<string | null>(null);
const [disableSubmitButton, setDisableSubmitButton] = useState(false);
Expand Down
4 changes: 3 additions & 1 deletion src/apps/patron-page/sections/StatusSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import Link from "../../../components/atoms/links/Link";

const StatusSection: FC = () => {
const t = useText();
const { alwaysAvailableEreolenUrl } = useUrls();
const u = useUrls();
const alwaysAvailableEreolenUrl = u("alwaysAvailableEreolenUrl");

const { data: libraryProfileFetched } = useGetV1LibraryProfile();
const { isSuccess, data } = useGetV1UserLoans();
const [libraryProfile, setLibraryProfile] = useState<LibraryProfile | null>(
Expand Down
Loading

0 comments on commit 4e3d883

Please sign in to comment.