mirror of
https://github.com/aljazceru/landscape-template.git
synced 2025-12-18 14:54:23 +01:00
update: disable save draft btn on published posts
This commit is contained in:
@@ -87,6 +87,7 @@ export interface NexusGenObjects {
|
|||||||
deadline: string; // String!
|
deadline: string; // String!
|
||||||
excerpt: string; // String!
|
excerpt: string; // String!
|
||||||
id: number; // Int!
|
id: number; // Int!
|
||||||
|
is_published?: boolean | null; // Boolean
|
||||||
reward_amount: number; // Int!
|
reward_amount: number; // Int!
|
||||||
title: string; // String!
|
title: string; // String!
|
||||||
votes_count: number; // Int!
|
votes_count: number; // Int!
|
||||||
@@ -161,6 +162,7 @@ export interface NexusGenObjects {
|
|||||||
createdAt: NexusGenScalars['Date']; // Date!
|
createdAt: NexusGenScalars['Date']; // Date!
|
||||||
excerpt: string; // String!
|
excerpt: string; // String!
|
||||||
id: number; // Int!
|
id: number; // Int!
|
||||||
|
is_published?: boolean | null; // Boolean
|
||||||
title: string; // String!
|
title: string; // String!
|
||||||
votes_count: number; // Int!
|
votes_count: number; // Int!
|
||||||
}
|
}
|
||||||
@@ -170,6 +172,7 @@ export interface NexusGenObjects {
|
|||||||
createdAt: NexusGenScalars['Date']; // Date!
|
createdAt: NexusGenScalars['Date']; // Date!
|
||||||
excerpt: string; // String!
|
excerpt: string; // String!
|
||||||
id: number; // Int!
|
id: number; // Int!
|
||||||
|
is_published?: boolean | null; // Boolean
|
||||||
title: string; // String!
|
title: string; // String!
|
||||||
votes_count: number; // Int!
|
votes_count: number; // Int!
|
||||||
}
|
}
|
||||||
@@ -243,6 +246,7 @@ export interface NexusGenFieldTypes {
|
|||||||
deadline: string; // String!
|
deadline: string; // String!
|
||||||
excerpt: string; // String!
|
excerpt: string; // String!
|
||||||
id: number; // Int!
|
id: number; // Int!
|
||||||
|
is_published: boolean | null; // Boolean
|
||||||
reward_amount: number; // Int!
|
reward_amount: number; // Int!
|
||||||
tags: NexusGenRootTypes['Tag'][]; // [Tag!]!
|
tags: NexusGenRootTypes['Tag'][]; // [Tag!]!
|
||||||
title: string; // String!
|
title: string; // String!
|
||||||
@@ -357,6 +361,7 @@ export interface NexusGenFieldTypes {
|
|||||||
createdAt: NexusGenScalars['Date']; // Date!
|
createdAt: NexusGenScalars['Date']; // Date!
|
||||||
excerpt: string; // String!
|
excerpt: string; // String!
|
||||||
id: number; // Int!
|
id: number; // Int!
|
||||||
|
is_published: boolean | null; // Boolean
|
||||||
tags: NexusGenRootTypes['Tag'][]; // [Tag!]!
|
tags: NexusGenRootTypes['Tag'][]; // [Tag!]!
|
||||||
title: string; // String!
|
title: string; // String!
|
||||||
type: string; // String!
|
type: string; // String!
|
||||||
@@ -371,6 +376,7 @@ export interface NexusGenFieldTypes {
|
|||||||
createdAt: NexusGenScalars['Date']; // Date!
|
createdAt: NexusGenScalars['Date']; // Date!
|
||||||
excerpt: string; // String!
|
excerpt: string; // String!
|
||||||
id: number; // Int!
|
id: number; // Int!
|
||||||
|
is_published: boolean | null; // Boolean
|
||||||
tags: NexusGenRootTypes['Tag'][]; // [Tag!]!
|
tags: NexusGenRootTypes['Tag'][]; // [Tag!]!
|
||||||
title: string; // String!
|
title: string; // String!
|
||||||
type: string; // String!
|
type: string; // String!
|
||||||
@@ -413,6 +419,7 @@ export interface NexusGenFieldTypes {
|
|||||||
createdAt: NexusGenScalars['Date']; // Date!
|
createdAt: NexusGenScalars['Date']; // Date!
|
||||||
excerpt: string; // String!
|
excerpt: string; // String!
|
||||||
id: number; // Int!
|
id: number; // Int!
|
||||||
|
is_published: boolean | null; // Boolean
|
||||||
title: string; // String!
|
title: string; // String!
|
||||||
votes_count: number; // Int!
|
votes_count: number; // Int!
|
||||||
}
|
}
|
||||||
@@ -442,6 +449,7 @@ export interface NexusGenFieldTypeNames {
|
|||||||
deadline: 'String'
|
deadline: 'String'
|
||||||
excerpt: 'String'
|
excerpt: 'String'
|
||||||
id: 'Int'
|
id: 'Int'
|
||||||
|
is_published: 'Boolean'
|
||||||
reward_amount: 'Int'
|
reward_amount: 'Int'
|
||||||
tags: 'Tag'
|
tags: 'Tag'
|
||||||
title: 'String'
|
title: 'String'
|
||||||
@@ -556,6 +564,7 @@ export interface NexusGenFieldTypeNames {
|
|||||||
createdAt: 'Date'
|
createdAt: 'Date'
|
||||||
excerpt: 'String'
|
excerpt: 'String'
|
||||||
id: 'Int'
|
id: 'Int'
|
||||||
|
is_published: 'Boolean'
|
||||||
tags: 'Tag'
|
tags: 'Tag'
|
||||||
title: 'String'
|
title: 'String'
|
||||||
type: 'String'
|
type: 'String'
|
||||||
@@ -570,6 +579,7 @@ export interface NexusGenFieldTypeNames {
|
|||||||
createdAt: 'Date'
|
createdAt: 'Date'
|
||||||
excerpt: 'String'
|
excerpt: 'String'
|
||||||
id: 'Int'
|
id: 'Int'
|
||||||
|
is_published: 'Boolean'
|
||||||
tags: 'Tag'
|
tags: 'Tag'
|
||||||
title: 'String'
|
title: 'String'
|
||||||
type: 'String'
|
type: 'String'
|
||||||
@@ -612,6 +622,7 @@ export interface NexusGenFieldTypeNames {
|
|||||||
createdAt: 'Date'
|
createdAt: 'Date'
|
||||||
excerpt: 'String'
|
excerpt: 'String'
|
||||||
id: 'Int'
|
id: 'Int'
|
||||||
|
is_published: 'Boolean'
|
||||||
title: 'String'
|
title: 'String'
|
||||||
votes_count: 'Int'
|
votes_count: 'Int'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ type Bounty implements PostBase {
|
|||||||
deadline: String!
|
deadline: String!
|
||||||
excerpt: String!
|
excerpt: String!
|
||||||
id: Int!
|
id: Int!
|
||||||
|
is_published: Boolean
|
||||||
reward_amount: Int!
|
reward_amount: Int!
|
||||||
tags: [Tag!]!
|
tags: [Tag!]!
|
||||||
title: String!
|
title: String!
|
||||||
@@ -113,6 +114,7 @@ interface PostBase {
|
|||||||
createdAt: Date!
|
createdAt: Date!
|
||||||
excerpt: String!
|
excerpt: String!
|
||||||
id: Int!
|
id: Int!
|
||||||
|
is_published: Boolean
|
||||||
title: String!
|
title: String!
|
||||||
votes_count: Int!
|
votes_count: Int!
|
||||||
}
|
}
|
||||||
@@ -172,6 +174,7 @@ type Question implements PostBase {
|
|||||||
createdAt: Date!
|
createdAt: Date!
|
||||||
excerpt: String!
|
excerpt: String!
|
||||||
id: Int!
|
id: Int!
|
||||||
|
is_published: Boolean
|
||||||
tags: [Tag!]!
|
tags: [Tag!]!
|
||||||
title: String!
|
title: String!
|
||||||
type: String!
|
type: String!
|
||||||
@@ -187,6 +190,7 @@ type Story implements PostBase {
|
|||||||
createdAt: Date!
|
createdAt: Date!
|
||||||
excerpt: String!
|
excerpt: String!
|
||||||
id: Int!
|
id: Int!
|
||||||
|
is_published: Boolean
|
||||||
tags: [Tag!]!
|
tags: [Tag!]!
|
||||||
title: String!
|
title: String!
|
||||||
type: String!
|
type: String!
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ const PostBase = interfaceType({
|
|||||||
t.nonNull.string('body');
|
t.nonNull.string('body');
|
||||||
t.nonNull.string('excerpt');
|
t.nonNull.string('excerpt');
|
||||||
t.nonNull.int('votes_count');
|
t.nonNull.int('votes_count');
|
||||||
|
t.boolean('is_published');
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ model Question {
|
|||||||
body String
|
body String
|
||||||
excerpt String
|
excerpt String
|
||||||
votes_count Int @default(0)
|
votes_count Int @default(0)
|
||||||
|
is_published Boolean @default(true)
|
||||||
|
|
||||||
|
|
||||||
tags Tag[]
|
tags Tag[]
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ interface IFormInputs {
|
|||||||
tags: NestedValue<{ title: string }[]>
|
tags: NestedValue<{ title: string }[]>
|
||||||
cover_image: NestedValue<File[]> | NestedValue<string[]>
|
cover_image: NestedValue<File[]> | NestedValue<string[]>
|
||||||
body: string
|
body: string
|
||||||
|
is_published: boolean | null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -83,6 +84,7 @@ export default function StoryForm() {
|
|||||||
cover_image: story?.cover_image ?? [],
|
cover_image: story?.cover_image ?? [],
|
||||||
tags: story?.tags ?? [],
|
tags: story?.tags ?? [],
|
||||||
body: story?.body ?? '',
|
body: story?.body ?? '',
|
||||||
|
is_published: story?.is_published ?? false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const { handleSubmit, control, register, formState: { errors, isValid, isSubmitted }, trigger, getValues, watch } = formMethods;
|
const { handleSubmit, control, register, formState: { errors, isValid, isSubmitted }, trigger, getValues, watch } = formMethods;
|
||||||
@@ -213,13 +215,14 @@ export default function StoryForm() {
|
|||||||
"Publish"
|
"Publish"
|
||||||
}
|
}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
{!story?.is_published &&
|
||||||
color="gray"
|
<Button
|
||||||
disabled={loading}
|
color="gray"
|
||||||
onClick={clickSubmit(false)}
|
disabled={loading}
|
||||||
>
|
onClick={clickSubmit(false)}
|
||||||
Save as Draft
|
>
|
||||||
</Button>
|
Save as Draft
|
||||||
|
</Button>}
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<div className="order-1 xl:sticky top-32 self-start flex flex-col gap-24">
|
<div className="order-1 xl:sticky top-32 self-start flex flex-col gap-24">
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ query PostDetails($id: Int!, $type: POST_TYPE!) {
|
|||||||
votes_count
|
votes_count
|
||||||
type
|
type
|
||||||
cover_image
|
cover_image
|
||||||
|
is_published
|
||||||
comments_count
|
comments_count
|
||||||
comments {
|
comments {
|
||||||
id
|
id
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ export type Bounty = PostBase & {
|
|||||||
deadline: Scalars['String'];
|
deadline: Scalars['String'];
|
||||||
excerpt: Scalars['String'];
|
excerpt: Scalars['String'];
|
||||||
id: Scalars['Int'];
|
id: Scalars['Int'];
|
||||||
|
is_published: Maybe<Scalars['Boolean']>;
|
||||||
reward_amount: Scalars['Int'];
|
reward_amount: Scalars['Int'];
|
||||||
tags: Array<Tag>;
|
tags: Array<Tag>;
|
||||||
title: Scalars['String'];
|
title: Scalars['String'];
|
||||||
@@ -174,6 +175,7 @@ export type PostBase = {
|
|||||||
createdAt: Scalars['Date'];
|
createdAt: Scalars['Date'];
|
||||||
excerpt: Scalars['String'];
|
excerpt: Scalars['String'];
|
||||||
id: Scalars['Int'];
|
id: Scalars['Int'];
|
||||||
|
is_published: Maybe<Scalars['Boolean']>;
|
||||||
title: Scalars['String'];
|
title: Scalars['String'];
|
||||||
votes_count: Scalars['Int'];
|
votes_count: Scalars['Int'];
|
||||||
};
|
};
|
||||||
@@ -314,6 +316,7 @@ export type Question = PostBase & {
|
|||||||
createdAt: Scalars['Date'];
|
createdAt: Scalars['Date'];
|
||||||
excerpt: Scalars['String'];
|
excerpt: Scalars['String'];
|
||||||
id: Scalars['Int'];
|
id: Scalars['Int'];
|
||||||
|
is_published: Maybe<Scalars['Boolean']>;
|
||||||
tags: Array<Tag>;
|
tags: Array<Tag>;
|
||||||
title: Scalars['String'];
|
title: Scalars['String'];
|
||||||
type: Scalars['String'];
|
type: Scalars['String'];
|
||||||
@@ -330,6 +333,7 @@ export type Story = PostBase & {
|
|||||||
createdAt: Scalars['Date'];
|
createdAt: Scalars['Date'];
|
||||||
excerpt: Scalars['String'];
|
excerpt: Scalars['String'];
|
||||||
id: Scalars['Int'];
|
id: Scalars['Int'];
|
||||||
|
is_published: Maybe<Scalars['Boolean']>;
|
||||||
tags: Array<Tag>;
|
tags: Array<Tag>;
|
||||||
title: Scalars['String'];
|
title: Scalars['String'];
|
||||||
type: Scalars['String'];
|
type: Scalars['String'];
|
||||||
@@ -503,7 +507,7 @@ export type PostDetailsQueryVariables = Exact<{
|
|||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
export type PostDetailsQuery = { __typename?: 'Query', getPostById: { __typename?: 'Bounty', id: number, title: string, createdAt: any, body: string, votes_count: number, type: string, cover_image: string | null, deadline: string, reward_amount: number, applicants_count: number, author: { __typename?: 'Author', id: number, name: string, avatar: string, join_date: any }, tags: Array<{ __typename?: 'Tag', id: number, title: string }>, applications: Array<{ __typename?: 'BountyApplication', id: number, date: string, workplan: string, author: { __typename?: 'Author', id: number, name: string, avatar: string } }> } | { __typename?: 'Question', id: number, title: string, createdAt: any, body: string, votes_count: number, type: string, answers_count: number, author: { __typename?: 'Author', id: number, name: string, avatar: string, join_date: any }, tags: Array<{ __typename?: 'Tag', id: number, title: string }>, comments: Array<{ __typename?: 'PostComment', id: number, createdAt: any, body: string, votes_count: number, parentId: number | null, author: { __typename?: 'Author', id: number, name: string, avatar: string } }> } | { __typename?: 'Story', id: number, title: string, createdAt: any, body: string, votes_count: number, type: string, cover_image: string | null, comments_count: number, author: { __typename?: 'Author', id: number, name: string, avatar: string, join_date: any }, tags: Array<{ __typename?: 'Tag', id: number, title: string }>, comments: Array<{ __typename?: 'PostComment', id: number, createdAt: any, body: string, votes_count: number, parentId: number | null, author: { __typename?: 'Author', id: number, name: string, avatar: string } }> } };
|
export type PostDetailsQuery = { __typename?: 'Query', getPostById: { __typename?: 'Bounty', id: number, title: string, createdAt: any, body: string, votes_count: number, type: string, cover_image: string | null, deadline: string, reward_amount: number, applicants_count: number, author: { __typename?: 'Author', id: number, name: string, avatar: string, join_date: any }, tags: Array<{ __typename?: 'Tag', id: number, title: string }>, applications: Array<{ __typename?: 'BountyApplication', id: number, date: string, workplan: string, author: { __typename?: 'Author', id: number, name: string, avatar: string } }> } | { __typename?: 'Question', id: number, title: string, createdAt: any, body: string, votes_count: number, type: string, answers_count: number, author: { __typename?: 'Author', id: number, name: string, avatar: string, join_date: any }, tags: Array<{ __typename?: 'Tag', id: number, title: string }>, comments: Array<{ __typename?: 'PostComment', id: number, createdAt: any, body: string, votes_count: number, parentId: number | null, author: { __typename?: 'Author', id: number, name: string, avatar: string } }> } | { __typename?: 'Story', id: number, title: string, createdAt: any, body: string, votes_count: number, type: string, cover_image: string | null, is_published: boolean | null, comments_count: number, author: { __typename?: 'Author', id: number, name: string, avatar: string, join_date: any }, tags: Array<{ __typename?: 'Tag', id: number, title: string }>, comments: Array<{ __typename?: 'PostComment', id: number, createdAt: any, body: string, votes_count: number, parentId: number | null, author: { __typename?: 'Author', id: number, name: string, avatar: string } }> } };
|
||||||
|
|
||||||
export type ProfileQueryVariables = Exact<{
|
export type ProfileQueryVariables = Exact<{
|
||||||
profileId: Scalars['Int'];
|
profileId: Scalars['Int'];
|
||||||
@@ -1221,6 +1225,7 @@ export const PostDetailsDocument = gql`
|
|||||||
votes_count
|
votes_count
|
||||||
type
|
type
|
||||||
cover_image
|
cover_image
|
||||||
|
is_published
|
||||||
comments_count
|
comments_count
|
||||||
comments {
|
comments {
|
||||||
id
|
id
|
||||||
|
|||||||
Reference in New Issue
Block a user