mirror of
https://github.com/aljazceru/landscape-template.git
synced 2025-12-18 23:04:20 +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!
|
||||
excerpt: string; // String!
|
||||
id: number; // Int!
|
||||
is_published?: boolean | null; // Boolean
|
||||
reward_amount: number; // Int!
|
||||
title: string; // String!
|
||||
votes_count: number; // Int!
|
||||
@@ -161,6 +162,7 @@ export interface NexusGenObjects {
|
||||
createdAt: NexusGenScalars['Date']; // Date!
|
||||
excerpt: string; // String!
|
||||
id: number; // Int!
|
||||
is_published?: boolean | null; // Boolean
|
||||
title: string; // String!
|
||||
votes_count: number; // Int!
|
||||
}
|
||||
@@ -170,6 +172,7 @@ export interface NexusGenObjects {
|
||||
createdAt: NexusGenScalars['Date']; // Date!
|
||||
excerpt: string; // String!
|
||||
id: number; // Int!
|
||||
is_published?: boolean | null; // Boolean
|
||||
title: string; // String!
|
||||
votes_count: number; // Int!
|
||||
}
|
||||
@@ -243,6 +246,7 @@ export interface NexusGenFieldTypes {
|
||||
deadline: string; // String!
|
||||
excerpt: string; // String!
|
||||
id: number; // Int!
|
||||
is_published: boolean | null; // Boolean
|
||||
reward_amount: number; // Int!
|
||||
tags: NexusGenRootTypes['Tag'][]; // [Tag!]!
|
||||
title: string; // String!
|
||||
@@ -357,6 +361,7 @@ export interface NexusGenFieldTypes {
|
||||
createdAt: NexusGenScalars['Date']; // Date!
|
||||
excerpt: string; // String!
|
||||
id: number; // Int!
|
||||
is_published: boolean | null; // Boolean
|
||||
tags: NexusGenRootTypes['Tag'][]; // [Tag!]!
|
||||
title: string; // String!
|
||||
type: string; // String!
|
||||
@@ -371,6 +376,7 @@ export interface NexusGenFieldTypes {
|
||||
createdAt: NexusGenScalars['Date']; // Date!
|
||||
excerpt: string; // String!
|
||||
id: number; // Int!
|
||||
is_published: boolean | null; // Boolean
|
||||
tags: NexusGenRootTypes['Tag'][]; // [Tag!]!
|
||||
title: string; // String!
|
||||
type: string; // String!
|
||||
@@ -413,6 +419,7 @@ export interface NexusGenFieldTypes {
|
||||
createdAt: NexusGenScalars['Date']; // Date!
|
||||
excerpt: string; // String!
|
||||
id: number; // Int!
|
||||
is_published: boolean | null; // Boolean
|
||||
title: string; // String!
|
||||
votes_count: number; // Int!
|
||||
}
|
||||
@@ -442,6 +449,7 @@ export interface NexusGenFieldTypeNames {
|
||||
deadline: 'String'
|
||||
excerpt: 'String'
|
||||
id: 'Int'
|
||||
is_published: 'Boolean'
|
||||
reward_amount: 'Int'
|
||||
tags: 'Tag'
|
||||
title: 'String'
|
||||
@@ -556,6 +564,7 @@ export interface NexusGenFieldTypeNames {
|
||||
createdAt: 'Date'
|
||||
excerpt: 'String'
|
||||
id: 'Int'
|
||||
is_published: 'Boolean'
|
||||
tags: 'Tag'
|
||||
title: 'String'
|
||||
type: 'String'
|
||||
@@ -570,6 +579,7 @@ export interface NexusGenFieldTypeNames {
|
||||
createdAt: 'Date'
|
||||
excerpt: 'String'
|
||||
id: 'Int'
|
||||
is_published: 'Boolean'
|
||||
tags: 'Tag'
|
||||
title: 'String'
|
||||
type: 'String'
|
||||
@@ -612,6 +622,7 @@ export interface NexusGenFieldTypeNames {
|
||||
createdAt: 'Date'
|
||||
excerpt: 'String'
|
||||
id: 'Int'
|
||||
is_published: 'Boolean'
|
||||
title: 'String'
|
||||
votes_count: 'Int'
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ type Bounty implements PostBase {
|
||||
deadline: String!
|
||||
excerpt: String!
|
||||
id: Int!
|
||||
is_published: Boolean
|
||||
reward_amount: Int!
|
||||
tags: [Tag!]!
|
||||
title: String!
|
||||
@@ -113,6 +114,7 @@ interface PostBase {
|
||||
createdAt: Date!
|
||||
excerpt: String!
|
||||
id: Int!
|
||||
is_published: Boolean
|
||||
title: String!
|
||||
votes_count: Int!
|
||||
}
|
||||
@@ -172,6 +174,7 @@ type Question implements PostBase {
|
||||
createdAt: Date!
|
||||
excerpt: String!
|
||||
id: Int!
|
||||
is_published: Boolean
|
||||
tags: [Tag!]!
|
||||
title: String!
|
||||
type: String!
|
||||
@@ -187,6 +190,7 @@ type Story implements PostBase {
|
||||
createdAt: Date!
|
||||
excerpt: String!
|
||||
id: Int!
|
||||
is_published: Boolean
|
||||
tags: [Tag!]!
|
||||
title: String!
|
||||
type: String!
|
||||
|
||||
@@ -57,6 +57,7 @@ const PostBase = interfaceType({
|
||||
t.nonNull.string('body');
|
||||
t.nonNull.string('excerpt');
|
||||
t.nonNull.int('votes_count');
|
||||
t.boolean('is_published');
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -141,6 +141,7 @@ model Question {
|
||||
body String
|
||||
excerpt String
|
||||
votes_count Int @default(0)
|
||||
is_published Boolean @default(true)
|
||||
|
||||
|
||||
tags Tag[]
|
||||
|
||||
@@ -48,6 +48,7 @@ interface IFormInputs {
|
||||
tags: NestedValue<{ title: string }[]>
|
||||
cover_image: NestedValue<File[]> | NestedValue<string[]>
|
||||
body: string
|
||||
is_published: boolean | null
|
||||
}
|
||||
|
||||
|
||||
@@ -83,6 +84,7 @@ export default function StoryForm() {
|
||||
cover_image: story?.cover_image ?? [],
|
||||
tags: story?.tags ?? [],
|
||||
body: story?.body ?? '',
|
||||
is_published: story?.is_published ?? false,
|
||||
},
|
||||
});
|
||||
const { handleSubmit, control, register, formState: { errors, isValid, isSubmitted }, trigger, getValues, watch } = formMethods;
|
||||
@@ -213,13 +215,14 @@ export default function StoryForm() {
|
||||
"Publish"
|
||||
}
|
||||
</Button>
|
||||
{!story?.is_published &&
|
||||
<Button
|
||||
color="gray"
|
||||
disabled={loading}
|
||||
onClick={clickSubmit(false)}
|
||||
>
|
||||
Save as Draft
|
||||
</Button>
|
||||
</Button>}
|
||||
</div>
|
||||
</form>
|
||||
<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
|
||||
type
|
||||
cover_image
|
||||
is_published
|
||||
comments_count
|
||||
comments {
|
||||
id
|
||||
|
||||
@@ -45,6 +45,7 @@ export type Bounty = PostBase & {
|
||||
deadline: Scalars['String'];
|
||||
excerpt: Scalars['String'];
|
||||
id: Scalars['Int'];
|
||||
is_published: Maybe<Scalars['Boolean']>;
|
||||
reward_amount: Scalars['Int'];
|
||||
tags: Array<Tag>;
|
||||
title: Scalars['String'];
|
||||
@@ -174,6 +175,7 @@ export type PostBase = {
|
||||
createdAt: Scalars['Date'];
|
||||
excerpt: Scalars['String'];
|
||||
id: Scalars['Int'];
|
||||
is_published: Maybe<Scalars['Boolean']>;
|
||||
title: Scalars['String'];
|
||||
votes_count: Scalars['Int'];
|
||||
};
|
||||
@@ -314,6 +316,7 @@ export type Question = PostBase & {
|
||||
createdAt: Scalars['Date'];
|
||||
excerpt: Scalars['String'];
|
||||
id: Scalars['Int'];
|
||||
is_published: Maybe<Scalars['Boolean']>;
|
||||
tags: Array<Tag>;
|
||||
title: Scalars['String'];
|
||||
type: Scalars['String'];
|
||||
@@ -330,6 +333,7 @@ export type Story = PostBase & {
|
||||
createdAt: Scalars['Date'];
|
||||
excerpt: Scalars['String'];
|
||||
id: Scalars['Int'];
|
||||
is_published: Maybe<Scalars['Boolean']>;
|
||||
tags: Array<Tag>;
|
||||
title: 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<{
|
||||
profileId: Scalars['Int'];
|
||||
@@ -1221,6 +1225,7 @@ export const PostDetailsDocument = gql`
|
||||
votes_count
|
||||
type
|
||||
cover_image
|
||||
is_published
|
||||
comments_count
|
||||
comments {
|
||||
id
|
||||
|
||||
Reference in New Issue
Block a user