Zoom images

This commit is contained in:
LittleSheep 2024-01-30 23:47:26 +08:00
parent 1ad7aed1cd
commit 4f756826d7
7 changed files with 150 additions and 308 deletions

View File

@ -4,16 +4,14 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames; var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty; var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => { var __export = (target, all) => {
for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
}; };
var __copyProps = (to, from, except, desc) => { var __copyProps = (to, from, except, desc) => {
if ((from && typeof from === "object") || typeof from === "function") { if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from)) for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except) if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
get: () => from[key],
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
});
} }
return to; return to;
}; };
@ -22,7 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
// keystone.ts // keystone.ts
var keystone_exports = {}; var keystone_exports = {};
__export(keystone_exports, { __export(keystone_exports, {
default: () => keystone_default, default: () => keystone_default
}); });
module.exports = __toCommonJS(keystone_exports); module.exports = __toCommonJS(keystone_exports);
var import_core8 = require("@keystone-6/core"); var import_core8 = require("@keystone-6/core");
@ -37,24 +35,24 @@ var allowUser = {
operation: { operation: {
create: isUser, create: isUser,
update: isUser, update: isUser,
delete: isUser, delete: isUser
}, }
}; };
var isEditor = ({ session: session2 }) => session2?.data.isEditor || session2?.data.isAdmin; var isEditor = ({ session: session2 }) => session2?.data.isEditor || session2?.data.isAdmin;
var allowEditor = { var allowEditor = {
operation: { operation: {
create: isEditor, create: isEditor,
update: isEditor, update: isEditor,
delete: isEditor, delete: isEditor
}, }
}; };
var isAdmin = ({ session: session2 }) => session2?.data.isAdmin; var isAdmin = ({ session: session2 }) => session2?.data.isAdmin;
var allowAdmin = { var allowAdmin = {
operation: { operation: {
create: isAdmin, create: isAdmin,
update: isAdmin, update: isAdmin,
delete: isAdmin, delete: isAdmin
}, }
}; };
// schema/assets.ts // schema/assets.ts
@ -66,9 +64,9 @@ var Image = (0, import_core.list)({
caption: (0, import_fields.text)(), caption: (0, import_fields.text)(),
image: (0, import_fields.image)({ storage: "localImages" }), image: (0, import_fields.image)({ storage: "localImages" }),
createdAt: (0, import_fields.timestamp)({ createdAt: (0, import_fields.timestamp)({
defaultValue: { kind: "now" }, defaultValue: { kind: "now" }
}), })
}, }
}); });
var Asset = (0, import_core.list)({ var Asset = (0, import_core.list)({
access: allowEditor, access: allowEditor,
@ -79,17 +77,17 @@ var Asset = (0, import_core.list)({
type: "enum", type: "enum",
options: [ options: [
{ label: "Video", value: "video" }, { label: "Video", value: "video" },
{ label: "Audio", value: "audio" }, { label: "Audio", value: "audio" }
], ],
defaultValue: "video", defaultValue: "video",
db: { map: "media_type" }, db: { map: "media_type" },
validation: { isRequired: true }, validation: { isRequired: true },
ui: { displayMode: "select" }, ui: { displayMode: "select" }
}), }),
createdAt: (0, import_fields.timestamp)({ createdAt: (0, import_fields.timestamp)({
defaultValue: { kind: "now" }, defaultValue: { kind: "now" }
}), })
}, }
}); });
// schema/moments.ts // schema/moments.ts
@ -108,10 +106,10 @@ var Moment = (0, import_core2.list)({
[1, 1, 1], [1, 1, 1],
[2, 1], [2, 1],
[1, 2], [1, 2],
[1, 2, 1], [1, 2, 1]
], ],
links: true, links: true,
dividers: true, dividers: true
}), }),
author: (0, import_fields2.relationship)({ author: (0, import_fields2.relationship)({
ref: "User.moments", ref: "User.moments",
@ -120,9 +118,9 @@ var Moment = (0, import_core2.list)({
cardFields: ["name", "email"], cardFields: ["name", "email"],
inlineEdit: { fields: ["name", "email"] }, inlineEdit: { fields: ["name", "email"] },
linkToItem: true, linkToItem: true,
inlineConnect: true, inlineConnect: true
}, },
many: false, many: false
}), }),
categories: (0, import_fields2.relationship)({ categories: (0, import_fields2.relationship)({
ref: "Category.moments", ref: "Category.moments",
@ -133,8 +131,8 @@ var Moment = (0, import_core2.list)({
inlineEdit: { fields: ["name"] }, inlineEdit: { fields: ["name"] },
linkToItem: true, linkToItem: true,
inlineConnect: true, inlineConnect: true,
inlineCreate: { fields: ["name"] }, inlineCreate: { fields: ["name"] }
}, }
}), }),
tags: (0, import_fields2.relationship)({ tags: (0, import_fields2.relationship)({
ref: "Tag.moments", ref: "Tag.moments",
@ -145,13 +143,13 @@ var Moment = (0, import_core2.list)({
inlineEdit: { fields: ["name"] }, inlineEdit: { fields: ["name"] },
linkToItem: true, linkToItem: true,
inlineConnect: true, inlineConnect: true,
inlineCreate: { fields: ["name"] }, inlineCreate: { fields: ["name"] }
}, }
}), }),
createdAt: (0, import_fields2.timestamp)({ createdAt: (0, import_fields2.timestamp)({
defaultValue: { kind: "now" }, defaultValue: { kind: "now" }
}), })
}, }
}); });
// schema/categories.ts // schema/categories.ts
@ -162,30 +160,30 @@ var Category = (0, import_core3.list)({
fields: { fields: {
slug: (0, import_fields3.text)({ slug: (0, import_fields3.text)({
validation: { validation: {
isRequired: true, isRequired: true
}, },
isIndexed: "unique", isIndexed: "unique"
}), }),
name: (0, import_fields3.text)(), name: (0, import_fields3.text)(),
posts: (0, import_fields3.relationship)({ ref: "Post.categories", many: true }), posts: (0, import_fields3.relationship)({ ref: "Post.categories", many: true }),
moments: (0, import_fields3.relationship)({ ref: "Moment.categories", many: true }), moments: (0, import_fields3.relationship)({ ref: "Moment.categories", many: true }),
events: (0, import_fields3.relationship)({ ref: "Event.categories", many: true }), events: (0, import_fields3.relationship)({ ref: "Event.categories", many: true })
}, }
}); });
var Tag = (0, import_core3.list)({ var Tag = (0, import_core3.list)({
access: allowEditor, access: allowEditor,
fields: { fields: {
slug: (0, import_fields3.text)({ slug: (0, import_fields3.text)({
validation: { validation: {
isRequired: true, isRequired: true
}, },
isIndexed: "unique", isIndexed: "unique"
}), }),
name: (0, import_fields3.text)(), name: (0, import_fields3.text)(),
posts: (0, import_fields3.relationship)({ ref: "Post.tags", many: true }), posts: (0, import_fields3.relationship)({ ref: "Post.tags", many: true }),
moments: (0, import_fields3.relationship)({ ref: "Moment.tags", many: true }), moments: (0, import_fields3.relationship)({ ref: "Moment.tags", many: true }),
events: (0, import_fields3.relationship)({ ref: "Event.tags", many: true }), events: (0, import_fields3.relationship)({ ref: "Event.tags", many: true })
}, }
}); });
// schema/projects.ts // schema/projects.ts
@ -196,10 +194,11 @@ var Project = (0, import_core4.list)({
...allowAdmin, ...allowAdmin,
filter: { filter: {
query: ({ session: session2 }) => { query: ({ session: session2 }) => {
if (session2?.data.isEditor || session2?.data.isAdmin) return true; if (session2?.data.isEditor || session2?.data.isAdmin)
return true;
return { isPublished: { equals: true } }; return { isPublished: { equals: true } };
}, }
}, }
}, },
fields: { fields: {
icon: (0, import_fields4.relationship)({ ref: "Image" }), icon: (0, import_fields4.relationship)({ ref: "Image" }),
@ -213,18 +212,18 @@ var Project = (0, import_core4.list)({
{ label: "Pending", value: "pending" }, { label: "Pending", value: "pending" },
{ label: "Constructing", value: "constructing" }, { label: "Constructing", value: "constructing" },
{ label: "Published", value: "published" }, { label: "Published", value: "published" },
{ label: "Abandoned", value: "abandoned" }, { label: "Abandoned", value: "abandoned" }
], ],
defaultValue: "pending", defaultValue: "pending",
db: { map: "project_status" }, db: { map: "project_status" },
validation: { isRequired: true }, validation: { isRequired: true },
ui: { displayMode: "select" }, ui: { displayMode: "select" }
}), }),
post: (0, import_fields4.relationship)({ ref: "Post" }), post: (0, import_fields4.relationship)({ ref: "Post" }),
createdAt: (0, import_fields4.timestamp)({ createdAt: (0, import_fields4.timestamp)({
defaultValue: { kind: "now" }, defaultValue: { kind: "now" }
}), })
}, }
}); });
// schema/posts.ts // schema/posts.ts
@ -236,17 +235,18 @@ var Post = (0, import_core5.list)({
...allowEditor, ...allowEditor,
filter: { filter: {
query: ({ session: session2 }) => { query: ({ session: session2 }) => {
if (session2?.data.isEditor || session2?.data.isAdmin) return true; if (session2?.data.isEditor || session2?.data.isAdmin)
return true;
return { isPublished: { equals: true } }; return { isPublished: { equals: true } };
}, }
}, }
}, },
fields: { fields: {
slug: (0, import_fields5.text)({ slug: (0, import_fields5.text)({
validation: { validation: {
isRequired: true, isRequired: true
}, },
isIndexed: "unique", isIndexed: "unique"
}), }),
title: (0, import_fields5.text)({ validation: { isRequired: true } }), title: (0, import_fields5.text)({ validation: { isRequired: true } }),
cover: (0, import_fields5.relationship)({ ref: "Image" }), cover: (0, import_fields5.relationship)({ ref: "Image" }),
@ -260,21 +260,21 @@ var Post = (0, import_core5.list)({
[1, 1, 1], [1, 1, 1],
[2, 1], [2, 1],
[1, 2], [1, 2],
[1, 2, 1], [1, 2, 1]
], ],
links: true, links: true,
dividers: true, dividers: true
}), }),
type: (0, import_fields5.select)({ type: (0, import_fields5.select)({
type: "enum", type: "enum",
options: [ options: [
{ label: "Article", value: "article" }, { label: "Article", value: "article" },
{ label: "Podcast", value: "podcast" }, { label: "Podcast", value: "podcast" }
], ],
defaultValue: "article", defaultValue: "article",
db: { map: "post_type" }, db: { map: "post_type" },
validation: { isRequired: true }, validation: { isRequired: true },
ui: { displayMode: "select" }, ui: { displayMode: "select" }
}), }),
isPublished: (0, import_fields5.checkbox)(), isPublished: (0, import_fields5.checkbox)(),
author: (0, import_fields5.relationship)({ author: (0, import_fields5.relationship)({
@ -284,9 +284,9 @@ var Post = (0, import_core5.list)({
cardFields: ["name", "email"], cardFields: ["name", "email"],
inlineEdit: { fields: ["name", "email"] }, inlineEdit: { fields: ["name", "email"] },
linkToItem: true, linkToItem: true,
inlineConnect: true, inlineConnect: true
}, },
many: false, many: false
}), }),
categories: (0, import_fields5.relationship)({ categories: (0, import_fields5.relationship)({
ref: "Category.posts", ref: "Category.posts",
@ -297,8 +297,8 @@ var Post = (0, import_core5.list)({
inlineEdit: { fields: ["name"] }, inlineEdit: { fields: ["name"] },
linkToItem: true, linkToItem: true,
inlineConnect: true, inlineConnect: true,
inlineCreate: { fields: ["name"] }, inlineCreate: { fields: ["name"] }
}, }
}), }),
tags: (0, import_fields5.relationship)({ tags: (0, import_fields5.relationship)({
ref: "Tag.posts", ref: "Tag.posts",
@ -309,13 +309,13 @@ var Post = (0, import_core5.list)({
inlineEdit: { fields: ["name"] }, inlineEdit: { fields: ["name"] },
linkToItem: true, linkToItem: true,
inlineConnect: true, inlineConnect: true,
inlineCreate: { fields: ["name"] }, inlineCreate: { fields: ["name"] }
}, }
}), }),
createdAt: (0, import_fields5.timestamp)({ createdAt: (0, import_fields5.timestamp)({
defaultValue: { kind: "now" }, defaultValue: { kind: "now" }
}), })
}, }
}); });
// schema/events.ts // schema/events.ts
@ -327,17 +327,18 @@ var Event = (0, import_core6.list)({
...allowEditor, ...allowEditor,
filter: { filter: {
query: ({ session: session2 }) => { query: ({ session: session2 }) => {
if (session2?.data.isEditor || session2?.data.isAdmin) return true; if (session2?.data.isEditor || session2?.data.isAdmin)
return true;
return { isPublished: { equals: true } }; return { isPublished: { equals: true } };
}, }
}, }
}, },
fields: { fields: {
slug: (0, import_fields6.text)({ slug: (0, import_fields6.text)({
validation: { validation: {
isRequired: true, isRequired: true
}, },
isIndexed: "unique", isIndexed: "unique"
}), }),
title: (0, import_fields6.text)({ validation: { isRequired: true } }), title: (0, import_fields6.text)({ validation: { isRequired: true } }),
description: (0, import_fields6.text)(), description: (0, import_fields6.text)(),
@ -348,10 +349,10 @@ var Event = (0, import_core6.list)({
[1, 1, 1], [1, 1, 1],
[2, 1], [2, 1],
[1, 2], [1, 2],
[1, 2, 1], [1, 2, 1]
], ],
links: true, links: true,
dividers: true, dividers: true
}), }),
isPublished: (0, import_fields6.checkbox)(), isPublished: (0, import_fields6.checkbox)(),
isHistory: (0, import_fields6.checkbox)(), isHistory: (0, import_fields6.checkbox)(),
@ -362,9 +363,9 @@ var Event = (0, import_core6.list)({
cardFields: ["name", "email"], cardFields: ["name", "email"],
inlineEdit: { fields: ["name", "email"] }, inlineEdit: { fields: ["name", "email"] },
linkToItem: true, linkToItem: true,
inlineConnect: true, inlineConnect: true
}, },
many: false, many: false
}), }),
categories: (0, import_fields6.relationship)({ categories: (0, import_fields6.relationship)({
ref: "Category.events", ref: "Category.events",
@ -375,8 +376,8 @@ var Event = (0, import_core6.list)({
inlineEdit: { fields: ["name"] }, inlineEdit: { fields: ["name"] },
linkToItem: true, linkToItem: true,
inlineConnect: true, inlineConnect: true,
inlineCreate: { fields: ["name"] }, inlineCreate: { fields: ["name"] }
}, }
}), }),
tags: (0, import_fields6.relationship)({ tags: (0, import_fields6.relationship)({
ref: "Tag.events", ref: "Tag.events",
@ -387,13 +388,13 @@ var Event = (0, import_core6.list)({
inlineEdit: { fields: ["name"] }, inlineEdit: { fields: ["name"] },
linkToItem: true, linkToItem: true,
inlineConnect: true, inlineConnect: true,
inlineCreate: { fields: ["name"] }, inlineCreate: { fields: ["name"] }
}, }
}), }),
createdAt: (0, import_fields6.timestamp)({ createdAt: (0, import_fields6.timestamp)({
defaultValue: { kind: "now" }, defaultValue: { kind: "now" }
}), })
}, }
}); });
// schema/index.ts // schema/index.ts
@ -404,7 +405,7 @@ var lists = {
name: (0, import_fields7.text)({ validation: { isRequired: true } }), name: (0, import_fields7.text)({ validation: { isRequired: true } }),
email: (0, import_fields7.text)({ email: (0, import_fields7.text)({
validation: { isRequired: true }, validation: { isRequired: true },
isIndexed: "unique", isIndexed: "unique"
}), }),
password: (0, import_fields7.password)({ validation: { isRequired: true } }), password: (0, import_fields7.password)({ validation: { isRequired: true } }),
posts: (0, import_fields7.relationship)({ ref: "Post.author", many: true }), posts: (0, import_fields7.relationship)({ ref: "Post.author", many: true }),
@ -413,9 +414,9 @@ var lists = {
isAdmin: (0, import_fields7.checkbox)(), isAdmin: (0, import_fields7.checkbox)(),
isEditor: (0, import_fields7.checkbox)(), isEditor: (0, import_fields7.checkbox)(),
createdAt: (0, import_fields7.timestamp)({ createdAt: (0, import_fields7.timestamp)({
defaultValue: { kind: "now" }, defaultValue: { kind: "now" }
}), })
}, }
}), }),
Image, Image,
Asset, Asset,
@ -424,7 +425,7 @@ var lists = {
Project, Project,
Event, Event,
Category, Category,
Tag, Tag
}; };
// auth.ts // auth.ts
@ -441,13 +442,13 @@ var { withAuth } = (0, import_auth.createAuth)({
sessionData: "id name createdAt isAdmin isEditor", sessionData: "id name createdAt isAdmin isEditor",
secretField: "password", secretField: "password",
initFirstItem: { initFirstItem: {
fields: ["name", "email", "password", "isAdmin"], fields: ["name", "email", "password", "isAdmin"]
}, }
}); });
var sessionMaxAge = 60 * 60 * 24 * 30; var sessionMaxAge = 60 * 60 * 24 * 30;
var session = (0, import_session.statelessSessions)({ var session = (0, import_session.statelessSessions)({
maxAge: sessionMaxAge, maxAge: sessionMaxAge,
secret: sessionSecret, secret: sessionSecret
}); });
// keystone.ts // keystone.ts
@ -457,17 +458,17 @@ var databaseProvider = process.env.DATABASE_PROVIDER ?? "postgresql";
var keystone_default = withAuth( var keystone_default = withAuth(
(0, import_core8.config)({ (0, import_core8.config)({
ui: { ui: {
basePath: "/cms", basePath: "/cms"
}, },
db: { db: {
provider: databaseProvider, provider: databaseProvider,
url: databaseUrl, url: databaseUrl
}, },
server: { server: {
cors: { cors: {
origin: "*", origin: "*",
methods: "GET,HEAD,PUT,PATCH,POST,DELETE", methods: "GET,HEAD,PUT,PATCH,POST,DELETE"
}, }
}, },
storage: { storage: {
localImages: { localImages: {
@ -475,13 +476,13 @@ var keystone_default = withAuth(
type: "image", type: "image",
generateUrl: (path) => `${baseUrl}/images${path}`, generateUrl: (path) => `${baseUrl}/images${path}`,
serverRoute: { serverRoute: {
path: "/images", path: "/images"
}, },
storagePath: "public/images", storagePath: "public/images"
}, }
}, },
lists, lists,
session, session
}), })
); );
//# sourceMappingURL=config.js.map //# sourceMappingURL=config.js.map

File diff suppressed because one or more lines are too long

View File

@ -6,29 +6,11 @@ type User {
name: String name: String
email: String email: String
password: PasswordState password: PasswordState
posts( posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!]
where: PostWhereInput! = {}
orderBy: [PostOrderByInput!]! = []
take: Int
skip: Int! = 0
cursor: PostWhereUniqueInput
): [Post!]
postsCount(where: PostWhereInput! = {}): Int postsCount(where: PostWhereInput! = {}): Int
moments( moments(where: MomentWhereInput! = {}, orderBy: [MomentOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: MomentWhereUniqueInput): [Moment!]
where: MomentWhereInput! = {}
orderBy: [MomentOrderByInput!]! = []
take: Int
skip: Int! = 0
cursor: MomentWhereUniqueInput
): [Moment!]
momentsCount(where: MomentWhereInput! = {}): Int momentsCount(where: MomentWhereInput! = {}): Int
events( events(where: EventWhereInput! = {}, orderBy: [EventOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: EventWhereUniqueInput): [Event!]
where: EventWhereInput! = {}
orderBy: [EventOrderByInput!]! = []
take: Int
skip: Int! = 0
cursor: EventWhereUniqueInput
): [Event!]
eventsCount(where: EventWhereInput! = {}): Int eventsCount(where: EventWhereInput! = {}): Int
isAdmin: Boolean isAdmin: Boolean
isEditor: Boolean isEditor: Boolean
@ -271,9 +253,7 @@ input ImageFieldInput {
upload: Upload! upload: Upload!
} }
""" """The `Upload` scalar type represents a file upload."""
The `Upload` scalar type represents a file upload.
"""
scalar Upload scalar Upload
input ImageUpdateArgs { input ImageUpdateArgs {
@ -355,41 +335,17 @@ type Post {
title: String title: String
cover: Image cover: Image
description: String description: String
assets( assets(where: AssetWhereInput! = {}, orderBy: [AssetOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: AssetWhereUniqueInput): [Asset!]
where: AssetWhereInput! = {}
orderBy: [AssetOrderByInput!]! = []
take: Int
skip: Int! = 0
cursor: AssetWhereUniqueInput
): [Asset!]
assetsCount(where: AssetWhereInput! = {}): Int assetsCount(where: AssetWhereInput! = {}): Int
images( images(where: ImageWhereInput! = {}, orderBy: [ImageOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: ImageWhereUniqueInput): [Image!]
where: ImageWhereInput! = {}
orderBy: [ImageOrderByInput!]! = []
take: Int
skip: Int! = 0
cursor: ImageWhereUniqueInput
): [Image!]
imagesCount(where: ImageWhereInput! = {}): Int imagesCount(where: ImageWhereInput! = {}): Int
content: Post_content_Document content: Post_content_Document
type: PostTypeType type: PostTypeType
isPublished: Boolean isPublished: Boolean
author: User author: User
categories( categories(where: CategoryWhereInput! = {}, orderBy: [CategoryOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: CategoryWhereUniqueInput): [Category!]
where: CategoryWhereInput! = {}
orderBy: [CategoryOrderByInput!]! = []
take: Int
skip: Int! = 0
cursor: CategoryWhereUniqueInput
): [Category!]
categoriesCount(where: CategoryWhereInput! = {}): Int categoriesCount(where: CategoryWhereInput! = {}): Int
tags( tags(where: TagWhereInput! = {}, orderBy: [TagOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TagWhereUniqueInput): [Tag!]
where: TagWhereInput! = {}
orderBy: [TagOrderByInput!]! = []
take: Int
skip: Int! = 0
cursor: TagWhereUniqueInput
): [Tag!]
tagsCount(where: TagWhereInput! = {}): Int tagsCount(where: TagWhereInput! = {}): Int
createdAt: DateTime createdAt: DateTime
} }
@ -578,31 +534,13 @@ input TagRelateToManyForCreateInput {
type Moment { type Moment {
id: ID! id: ID!
title: String title: String
images( images(where: ImageWhereInput! = {}, orderBy: [ImageOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: ImageWhereUniqueInput): [Image!]
where: ImageWhereInput! = {}
orderBy: [ImageOrderByInput!]! = []
take: Int
skip: Int! = 0
cursor: ImageWhereUniqueInput
): [Image!]
imagesCount(where: ImageWhereInput! = {}): Int imagesCount(where: ImageWhereInput! = {}): Int
content: Moment_content_Document content: Moment_content_Document
author: User author: User
categories( categories(where: CategoryWhereInput! = {}, orderBy: [CategoryOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: CategoryWhereUniqueInput): [Category!]
where: CategoryWhereInput! = {}
orderBy: [CategoryOrderByInput!]! = []
take: Int
skip: Int! = 0
cursor: CategoryWhereUniqueInput
): [Category!]
categoriesCount(where: CategoryWhereInput! = {}): Int categoriesCount(where: CategoryWhereInput! = {}): Int
tags( tags(where: TagWhereInput! = {}, orderBy: [TagOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TagWhereUniqueInput): [Tag!]
where: TagWhereInput! = {}
orderBy: [TagOrderByInput!]! = []
take: Int
skip: Int! = 0
cursor: TagWhereUniqueInput
): [Tag!]
tagsCount(where: TagWhereInput! = {}): Int tagsCount(where: TagWhereInput! = {}): Int
createdAt: DateTime createdAt: DateTime
} }
@ -761,21 +699,9 @@ type Event {
isPublished: Boolean isPublished: Boolean
isHistory: Boolean isHistory: Boolean
author: User author: User
categories( categories(where: CategoryWhereInput! = {}, orderBy: [CategoryOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: CategoryWhereUniqueInput): [Category!]
where: CategoryWhereInput! = {}
orderBy: [CategoryOrderByInput!]! = []
take: Int
skip: Int! = 0
cursor: CategoryWhereUniqueInput
): [Category!]
categoriesCount(where: CategoryWhereInput! = {}): Int categoriesCount(where: CategoryWhereInput! = {}): Int
tags( tags(where: TagWhereInput! = {}, orderBy: [TagOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TagWhereUniqueInput): [Tag!]
where: TagWhereInput! = {}
orderBy: [TagOrderByInput!]! = []
take: Int
skip: Int! = 0
cursor: TagWhereUniqueInput
): [Tag!]
tagsCount(where: TagWhereInput! = {}): Int tagsCount(where: TagWhereInput! = {}): Int
createdAt: DateTime createdAt: DateTime
} }
@ -850,29 +776,11 @@ type Category {
id: ID! id: ID!
slug: String slug: String
name: String name: String
posts( posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!]
where: PostWhereInput! = {}
orderBy: [PostOrderByInput!]! = []
take: Int
skip: Int! = 0
cursor: PostWhereUniqueInput
): [Post!]
postsCount(where: PostWhereInput! = {}): Int postsCount(where: PostWhereInput! = {}): Int
moments( moments(where: MomentWhereInput! = {}, orderBy: [MomentOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: MomentWhereUniqueInput): [Moment!]
where: MomentWhereInput! = {}
orderBy: [MomentOrderByInput!]! = []
take: Int
skip: Int! = 0
cursor: MomentWhereUniqueInput
): [Moment!]
momentsCount(where: MomentWhereInput! = {}): Int momentsCount(where: MomentWhereInput! = {}): Int
events( events(where: EventWhereInput! = {}, orderBy: [EventOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: EventWhereUniqueInput): [Event!]
where: EventWhereInput! = {}
orderBy: [EventOrderByInput!]! = []
take: Int
skip: Int! = 0
cursor: EventWhereUniqueInput
): [Event!]
eventsCount(where: EventWhereInput! = {}): Int eventsCount(where: EventWhereInput! = {}): Int
} }
@ -924,29 +832,11 @@ type Tag {
id: ID! id: ID!
slug: String slug: String
name: String name: String
posts( posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!]
where: PostWhereInput! = {}
orderBy: [PostOrderByInput!]! = []
take: Int
skip: Int! = 0
cursor: PostWhereUniqueInput
): [Post!]
postsCount(where: PostWhereInput! = {}): Int postsCount(where: PostWhereInput! = {}): Int
moments( moments(where: MomentWhereInput! = {}, orderBy: [MomentOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: MomentWhereUniqueInput): [Moment!]
where: MomentWhereInput! = {}
orderBy: [MomentOrderByInput!]! = []
take: Int
skip: Int! = 0
cursor: MomentWhereUniqueInput
): [Moment!]
momentsCount(where: MomentWhereInput! = {}): Int momentsCount(where: MomentWhereInput! = {}): Int
events( events(where: EventWhereInput! = {}, orderBy: [EventOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: EventWhereUniqueInput): [Event!]
where: EventWhereInput! = {}
orderBy: [EventOrderByInput!]! = []
take: Int
skip: Int! = 0
cursor: EventWhereUniqueInput
): [Event!]
eventsCount(where: EventWhereInput! = {}): Int eventsCount(where: EventWhereInput! = {}): Int
} }
@ -1059,9 +949,7 @@ type Mutation {
createInitialUser(data: CreateInitialUserInput!): UserAuthenticationWithPasswordSuccess! createInitialUser(data: CreateInitialUserInput!): UserAuthenticationWithPasswordSuccess!
} }
union UserAuthenticationWithPasswordResult = union UserAuthenticationWithPasswordResult = UserAuthenticationWithPasswordSuccess | UserAuthenticationWithPasswordFailure
| UserAuthenticationWithPasswordSuccess
| UserAuthenticationWithPasswordFailure
type UserAuthenticationWithPasswordSuccess { type UserAuthenticationWithPasswordSuccess {
sessionToken: String! sessionToken: String!
@ -1080,85 +968,31 @@ input CreateInitialUserInput {
} }
type Query { type Query {
users( users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!]
where: UserWhereInput! = {}
orderBy: [UserOrderByInput!]! = []
take: Int
skip: Int! = 0
cursor: UserWhereUniqueInput
): [User!]
user(where: UserWhereUniqueInput!): User user(where: UserWhereUniqueInput!): User
usersCount(where: UserWhereInput! = {}): Int usersCount(where: UserWhereInput! = {}): Int
images( images(where: ImageWhereInput! = {}, orderBy: [ImageOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: ImageWhereUniqueInput): [Image!]
where: ImageWhereInput! = {}
orderBy: [ImageOrderByInput!]! = []
take: Int
skip: Int! = 0
cursor: ImageWhereUniqueInput
): [Image!]
image(where: ImageWhereUniqueInput!): Image image(where: ImageWhereUniqueInput!): Image
imagesCount(where: ImageWhereInput! = {}): Int imagesCount(where: ImageWhereInput! = {}): Int
assets( assets(where: AssetWhereInput! = {}, orderBy: [AssetOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: AssetWhereUniqueInput): [Asset!]
where: AssetWhereInput! = {}
orderBy: [AssetOrderByInput!]! = []
take: Int
skip: Int! = 0
cursor: AssetWhereUniqueInput
): [Asset!]
asset(where: AssetWhereUniqueInput!): Asset asset(where: AssetWhereUniqueInput!): Asset
assetsCount(where: AssetWhereInput! = {}): Int assetsCount(where: AssetWhereInput! = {}): Int
posts( posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!]
where: PostWhereInput! = {}
orderBy: [PostOrderByInput!]! = []
take: Int
skip: Int! = 0
cursor: PostWhereUniqueInput
): [Post!]
post(where: PostWhereUniqueInput!): Post post(where: PostWhereUniqueInput!): Post
postsCount(where: PostWhereInput! = {}): Int postsCount(where: PostWhereInput! = {}): Int
moments( moments(where: MomentWhereInput! = {}, orderBy: [MomentOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: MomentWhereUniqueInput): [Moment!]
where: MomentWhereInput! = {}
orderBy: [MomentOrderByInput!]! = []
take: Int
skip: Int! = 0
cursor: MomentWhereUniqueInput
): [Moment!]
moment(where: MomentWhereUniqueInput!): Moment moment(where: MomentWhereUniqueInput!): Moment
momentsCount(where: MomentWhereInput! = {}): Int momentsCount(where: MomentWhereInput! = {}): Int
projects( projects(where: ProjectWhereInput! = {}, orderBy: [ProjectOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: ProjectWhereUniqueInput): [Project!]
where: ProjectWhereInput! = {}
orderBy: [ProjectOrderByInput!]! = []
take: Int
skip: Int! = 0
cursor: ProjectWhereUniqueInput
): [Project!]
project(where: ProjectWhereUniqueInput!): Project project(where: ProjectWhereUniqueInput!): Project
projectsCount(where: ProjectWhereInput! = {}): Int projectsCount(where: ProjectWhereInput! = {}): Int
events( events(where: EventWhereInput! = {}, orderBy: [EventOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: EventWhereUniqueInput): [Event!]
where: EventWhereInput! = {}
orderBy: [EventOrderByInput!]! = []
take: Int
skip: Int! = 0
cursor: EventWhereUniqueInput
): [Event!]
event(where: EventWhereUniqueInput!): Event event(where: EventWhereUniqueInput!): Event
eventsCount(where: EventWhereInput! = {}): Int eventsCount(where: EventWhereInput! = {}): Int
categories( categories(where: CategoryWhereInput! = {}, orderBy: [CategoryOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: CategoryWhereUniqueInput): [Category!]
where: CategoryWhereInput! = {}
orderBy: [CategoryOrderByInput!]! = []
take: Int
skip: Int! = 0
cursor: CategoryWhereUniqueInput
): [Category!]
category(where: CategoryWhereUniqueInput!): Category category(where: CategoryWhereUniqueInput!): Category
categoriesCount(where: CategoryWhereInput! = {}): Int categoriesCount(where: CategoryWhereInput! = {}): Int
tags( tags(where: TagWhereInput! = {}, orderBy: [TagOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TagWhereUniqueInput): [Tag!]
where: TagWhereInput! = {}
orderBy: [TagOrderByInput!]! = []
take: Int
skip: Int! = 0
cursor: TagWhereUniqueInput
): [Tag!]
tag(where: TagWhereUniqueInput!): Tag tag(where: TagWhereUniqueInput!): Tag
tagsCount(where: TagWhereInput! = {}): Int tagsCount(where: TagWhereInput! = {}): Int
keystone: KeystoneMeta! keystone: KeystoneMeta!

View File

@ -22,6 +22,7 @@
"aplayer": "^1.10.1", "aplayer": "^1.10.1",
"artplayer": "^5.1.1", "artplayer": "^5.1.1",
"astro": "^4.2.1", "astro": "^4.2.1",
"medium-zoom": "^1.1.0",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"sass": "^1.70.0", "sass": "^1.70.0",

View File

@ -13,17 +13,14 @@ const { title } = Astro.props;
<link rel="icon" type="image/svg+xml" href="/favicon.svg" /> <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width" /> <meta name="viewport" content="width=device-width" />
<meta name="generator" content={Astro.generator} /> <meta name="generator" content={Astro.generator} />
{title && (<title>山羊寒舍 | {title}</title>)} {title && <title>山羊寒舍 | {title}</title>}
{!title && (<title>山羊寒舍</title>)} {!title && <title>山羊寒舍</title>}
<script is:inline> <script is:inline>
if (localStorage.getItem("theme") === null) { if (localStorage.getItem("theme") === null) {
document.documentElement.setAttribute("data-theme", "light"); document.documentElement.setAttribute("data-theme", "light");
} else { } else {
document.documentElement.setAttribute( document.documentElement.setAttribute("data-theme", localStorage.getItem("theme"));
"data-theme",
localStorage.getItem("theme")
);
} }
</script> </script>

View File

@ -48,14 +48,14 @@ const { post } = (
}`, }`,
{ {
where: { slug }, where: { slug },
} },
) )
).data; ).data;
--- ---
<PageLayout title={post.title}> <PageLayout title={post.title}>
<div class="wrapper"> <div class="wrapper">
<div class="card w-full shadow-xl"> <div class="card w-full shadow-xl post">
{ {
post.cover && ( post.cover && (
<figure> <figure>
@ -101,10 +101,7 @@ const { post } = (
<div class="flex gap-1"> <div class="flex gap-1">
{ {
post.categories?.map((category: any) => ( post.categories?.map((category: any) => (
<a <a href={`/categories/${category.slug}`} class="link link-primary">
href={`/categories/${category.slug}`}
class="link link-primary"
>
{category.name} {category.name}
</a> </a>
)) ))
@ -134,6 +131,13 @@ const { post } = (
</div> </div>
</PageLayout> </PageLayout>
<script>
import mediumZoom from "medium-zoom";
mediumZoom(document.querySelectorAll(".post img"), {
background: "var(--fallback-b1,oklch(var(--b1)/1))",
});
</script>
<style> <style>
.wrapper { .wrapper {
display: grid; display: grid;

View File

@ -2409,6 +2409,11 @@ mdast-util-to-string@^4.0.0:
dependencies: dependencies:
"@types/mdast" "^4.0.0" "@types/mdast" "^4.0.0"
medium-zoom@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/medium-zoom/-/medium-zoom-1.1.0.tgz#6efb6bbda861a02064ee71a2617a8dc4381ecc71"
integrity sha512-ewyDsp7k4InCUp3jRmwHBRFGyjBimKps/AJLjRSox+2q/2H4p/PNpQf+pwONWlJiOudkBXtbdmVbFjqyybfTmQ==
merge-stream@^2.0.0: merge-stream@^2.0.0:
version "2.0.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60"