mirror of
https://github.com/aljazceru/landscape-template.git
synced 2026-02-22 23:14:26 +01:00
fix: screenshots keys, show warning on updating project's hashtag
This commit is contained in:
@@ -13,6 +13,7 @@ import { store } from "src/redux/store";
|
||||
import UpdateProjectContextProvider from './updateProjectContext'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { createRoute } from 'src/utils/routing'
|
||||
import { nanoid } from "@reduxjs/toolkit";
|
||||
|
||||
|
||||
interface Props {
|
||||
@@ -160,10 +161,10 @@ export default function FormContainer(props: PropsWithChildren<Props>) {
|
||||
slack: data.slack,
|
||||
telegram: data.telegram,
|
||||
github: data.github,
|
||||
lightning_address:data.lightning_address,
|
||||
lightning_address: data.lightning_address,
|
||||
category_id: data.category.id,
|
||||
capabilities: data.capabilities.map(c => c.id),
|
||||
screenshots: data.screenshots.map(url => ({ url })),
|
||||
screenshots: data.screenshots.map(url => ({ url, local_id: nanoid(5), })),
|
||||
|
||||
members: prepareMembers(data.members),
|
||||
recruit_roles: data.recruit_roles.map(r => r.id),
|
||||
|
||||
@@ -14,7 +14,9 @@ interface Props { }
|
||||
|
||||
export default function ProjectDetailsTab(props: Props) {
|
||||
|
||||
const { register, formState: { errors, }, control, getValues } = useFormContext<IListProjectForm>();
|
||||
const { register, formState: { errors, dirtyFields }, control, getValues } = useFormContext<IListProjectForm>();
|
||||
|
||||
const isUpdating = !!getValues('id');
|
||||
|
||||
return (
|
||||
<div className="md:col-span-2 flex flex-col gap-24">
|
||||
@@ -124,6 +126,9 @@ export default function ProjectDetailsTab(props: Props) {
|
||||
{...register("hashtag")}
|
||||
/>
|
||||
</div>
|
||||
{(isUpdating && dirtyFields.hashtag) && <p className="text-body5 text-orange-500 mt-8">
|
||||
<span className="font-bolder text-orange-400">Warning:</span> changing the hashtag of the project will break all the old links for the project.
|
||||
</p>}
|
||||
{errors.hashtag && <p className="input-error">
|
||||
{errors.hashtag.message}
|
||||
</p>}
|
||||
|
||||
Reference in New Issue
Block a user