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

Production deployment #1065

Merged
merged 2 commits into from
Jan 8, 2025
Merged
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
30 changes: 29 additions & 1 deletion app/src/career/components/CreateNodeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import Button from "@/common/components/Button";
import Modal from "@/common/components/Modal";
import { RadioGroup } from "@/common/components/form/RadioGroup";
import { Select } from "@/common/components/form/Select";
import { env } from "@/env";
import { FlowNodeRoleImage, type Role } from "@prisma/client";
import clsx from "clsx";
import Image from "next/image";
import { useId, useState, type FormEventHandler } from "react";

type Props = Readonly<{
Expand All @@ -20,13 +22,16 @@ export const CreateNodeModal = ({
roles,
}: Props) => {
const [nodeType, setNodeType] = useState("role");
const [roleId, setRoleId] = useState<Role["id"]>(roles[0].id);
const [roleImage, setRoleImage] = useState<keyof typeof FlowNodeRoleImage>(
FlowNodeRoleImage.ICON,
);
const roleInputId = useId();
const backgroundColorInputId = useId();
const backgroundTransparencyInputId = useId();

const role = roles.find((role) => role.id === roleId);

return (
<Modal
isOpen={true}
Expand Down Expand Up @@ -59,7 +64,12 @@ export const CreateNodeModal = ({
<label htmlFor={roleInputId} className="mt-6 block">
Rolle
</label>
<Select name="roleId" className="mt-2">
<Select
name="roleId"
className="mt-2"
value={roleId}
onChange={(e) => setRoleId(e.target.value)}
>
{roles.map((role) => (
<option key={role.id} value={role.id}>
{role.name}
Expand All @@ -85,6 +95,24 @@ export const CreateNodeModal = ({
onChange={setRoleImage}
className="mt-2"
/>
{roleImage === FlowNodeRoleImage.ICON && role && (
<Image
src={`https://${env.NEXT_PUBLIC_R2_PUBLIC_URL}/${role.iconId}`}
alt=""
width={128}
height={128}
className="mt-2 size-32 border border-neutral-700 rounded object-contain object-center"
/>
)}
{roleImage === FlowNodeRoleImage.THUMBNAIL && role && (
<Image
src={`https://${env.NEXT_PUBLIC_R2_PUBLIC_URL}/${role.thumbnailId}`}
alt=""
width={228}
height={128}
className="mt-2 w-[228px] h-32 border border-neutral-700 rounded object-contain object-center"
/>
)}
</>
)}

Expand Down
5 changes: 4 additions & 1 deletion app/src/career/components/Flow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ export const Flow = ({ className, flow, roles }: Props) => {
x: 0,
y: 0,
},
width: 100,
width:
result.data.roleImage === FlowNodeRoleImage.THUMBNAIL
? 178
: 100,
height: 100,
data: {
role,
Expand Down
2 changes: 1 addition & 1 deletion app/src/career/components/RoleNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export type RoleNode = Node<
export const RoleNode = (props: NodeProps<RoleNode>) => {
const nodeId = useNodeId();
const { setNodes, setEdges } = useReactFlow();
const [isResizing, setIsResizing] = useState(true);
const [isResizing, setIsResizing] = useState(false);

const onDelete = useCallback(() => {
setNodes((nodes) => nodes.filter((node) => node.id !== nodeId));
Expand Down
Loading