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

Fix/embed #160

Merged
merged 13 commits into from
Oct 18, 2024
14 changes: 11 additions & 3 deletions client/src/app/(embed)/embed/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
"use client";
import CountryDetail from "@/containers/countries/countries-detail";
import Popup from "@/containers/popup";

import { useSyncCountry } from "@/app/store";

export default function EmbedPage() {
const [country] = useSyncCountry();

return (
<div className="max-w-md xl:max-w-xl 2xl:max-w-4xl">
<CountryDetail embed />
</div>
<Popup visibleKey={country} className="left-0 z-10">
<div className=" max-w-md xl:max-w-xl 2xl:max-w-4xl">
<CountryDetail embed />
</div>
</Popup>
);
}
6 changes: 4 additions & 2 deletions client/src/app/api/auth/[...nextauth]/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ export const authOptions: AuthOptions = {

const sessionToken = session.sessionToken ?? token;

if (sessionToken && decoded.iat) {
if (sessionToken) {
const now = new Date().getTime();
const exp = decoded.iat * 1000 + SESSION_MAX_AGE * 1000;
const exp = decoded.iat
? decoded.iat * 1000 + SESSION_MAX_AGE * 1000
: SESSION_MAX_AGE * 1000;

if (now < exp) {
return {
Expand Down
4 changes: 3 additions & 1 deletion client/src/containers/popup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import { cn } from "@/lib/classnames";
const Popup = ({
visibleKey,
children,
}: PropsWithChildren<{ visibleKey: string | number | null }>): JSX.Element => {
className,
}: PropsWithChildren<{ visibleKey: string | number | null; className?: string }>): JSX.Element => {
const [open, setOpen] = useState(false);

const toggleOpen = () => setOpen((prev) => !prev);
Expand All @@ -25,6 +26,7 @@ const Popup = ({
true,
"-translate-x-full": !open && visibleKey,
"translate-x-0": open && visibleKey,
[className || ""]: !!className,
})}
>
<div className="relative z-10 h-full max-h-screen w-full overflow-auto rounded-br-3xl bg-white">
Expand Down
3 changes: 2 additions & 1 deletion client/src/containers/welcome-message/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { useGetWelcomeMessage } from "@/types/generated/welcome-message";

import { Button } from "@/components/ui/button";
import { Dialog, DialogContent } from "@/components/ui/dialog";
import isEmpty from "lodash-es/isEmpty";

export default function WelcomeMessage() {
const videoRef = useRef<ReactPlayer>(null);
Expand All @@ -40,7 +41,7 @@ export default function WelcomeMessage() {
const handleFullscreen = () => {
setFullscreen(screenfull?.isFullscreen);
};

useEffect(() => {
if (screenfull.isEnabled) {
screenfull.on("change", handleFullscreen);
Expand Down
2 changes: 1 addition & 1 deletion cms/config/sync/user-role.admin.json
Original file line number Diff line number Diff line change
Expand Up @@ -430,4 +430,4 @@
"action": "plugin::users-permissions.user.update"
}
]
}
}
5 changes: 1 addition & 4 deletions cms/config/sync/user-role.authenticated.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,6 @@
{
"action": "plugin::email.email.send"
},
{
"action": "plugin::import-export-entries.export.exportData"
},
{
"action": "plugin::import-export-entries.import.importData"
},
Expand Down Expand Up @@ -253,4 +250,4 @@
"action": "plugin::users-permissions.user.update"
}
]
}
}
5 changes: 1 addition & 4 deletions cms/config/sync/user-role.contributor.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,6 @@
{
"action": "plugin::content-type-builder.content-types.getContentTypes"
},
{
"action": "plugin::import-export-entries.export.exportData"
},
{
"action": "plugin::import-export-entries.import.importData"
},
Expand Down Expand Up @@ -277,4 +274,4 @@
"action": "plugin::users-permissions.user.update"
}
]
}
}
Loading