Skip to content

Commit

Permalink
Merge pull request #11 from blinko-space/main
Browse files Browse the repository at this point in the history
Merge to v0.0.3
  • Loading branch information
blinko-space authored Oct 27, 2024
2 parents a99600b + 348a180 commit 864aaf6
Show file tree
Hide file tree
Showing 34 changed files with 379 additions and 114 deletions.
Binary file removed .blinko/files/pic01.png
Binary file not shown.
Binary file removed .blinko/files/pic02.png
Binary file not shown.
Binary file removed .blinko/files/pic03.png
Binary file not shown.
Binary file removed .blinko/files/pic04.png
Binary file not shown.
Binary file removed .blinko/files/pic06.png
Binary file not shown.
Empty file removed .blinko/files/story.txt
Empty file.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Push Docker Image
name: Build and Push Release Docker Image

on:
push:
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/build-and-push-test-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build and Push Test Docker Image

on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Extract build args
run: |
echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
install: true
version: v0.9.1

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
blinkospace/blinko
ghcr.io/blinko-space/blinko
tags: |
type=raw,value=${{ env.VERSION }}
flavor: |
latest=false
- name: Build and Push
id: docker_build
uses: docker/build-push-action@v6
with:
context: ./
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ yarn.lock
public/robots.txt
public/sitemap*
public/assets
.blinko/faiss/*
.blinko/pgdump/*
.blinko/files/*
dump.sql
1 change: 1 addition & 0 deletions next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
6 changes: 4 additions & 2 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const isProduction = process.env.NODE_ENV === 'production';
module.exports = {
transpilePackages: ['@mdxeditor/editor', 'react-diff-view'],
webpack: (config, { isServer }) => {
Expand All @@ -10,9 +11,10 @@ module.exports = {
}
return config;
},
reactStrictMode: true,
outputFileTracing: true,
reactStrictMode: isProduction? true : false,
swcMinify:false,
eslint: {
ignoreDuringBuilds: true,
},
}
}
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blinko",
"version": "0.0.3",
"version": "0.0.4",
"private": true,
"browser": {
"fs": false,
Expand All @@ -20,7 +20,7 @@
"db-reset": "prisma migrate dev reset",
"dev": "next dev -p 1111",
"build": "set NODE_ENV=production & next build",
"start": "next start -p 1111",
"start": "prisma migrate & prisma db seed & next start -p 1111",
"lint": "next lint",
"analyze": "ANALYZE=true next build",
"postinstall": "pnpm generate"
Expand Down Expand Up @@ -49,6 +49,7 @@
"@types/mime-types": "^2.1.4",
"adm-zip": "^0.5.16",
"axios": "^1.7.7",
"canvas-confetti": "^1.9.3",
"clsx": "^2.1.1",
"cron": "^3.1.7",
"dataloader": "^2.2.2",
Expand Down Expand Up @@ -102,6 +103,7 @@
"remark-gfm": "^4.0.0",
"superjson": "^2.2.1",
"swagger-ui-react": "^5.17.14",
"swiper": "^11.1.14",
"tailwind-merge": "^1.13.0",
"trpc-to-openapi": "^2.0.2",
"typed-emitter": "^2.1.0",
Expand Down
17 changes: 17 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions prisma/migrations/20241027072348_0_0_3/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "notes" ADD COLUMN "isReviewed" BOOLEAN NOT NULL DEFAULT false;
1 change: 1 addition & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ model notes {
isRecycle Boolean @default(false)
isShare Boolean @default(false)
isTop Boolean @default(false)
isReviewed Boolean @default(false)
sharePassword String @default("") @db.VarChar
metadata Json? @db.Json
users Int @default(0)
Expand Down
6 changes: 5 additions & 1 deletion public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,9 @@
"every-half-year": "Every half year",
"import": "Import",
"impoort-from-bko": "Import from .bko",
"not-a-bko-file": "not a bko file"
"not-a-bko-file": "not a bko file",
"convert-to-note": "Convert to Note",
"convert-to-blinko": "Convert to Blinko",
"reviewed": "Reviewed",
"congratulations-youve-reviewed-everything-today": "you've reviewed everything today."
}
6 changes: 5 additions & 1 deletion public/locales/zh/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,9 @@
"every-day": "每天",
"import": "导入",
"impoort-from-bko": "从.bko文件导入",
"not-a-bko-file": "不是 bko 文件"
"not-a-bko-file": "不是 bko 文件",
"convert-to-note": "转换为笔记",
"convert-to-blinko": "转换为闪念",
"reviewed": "已回顾",
"congratulations-youve-reviewed-everything-today": "恭喜你,今天你已经回顾了所有内容"
}
28 changes: 12 additions & 16 deletions src/components/BlinkoRightClickMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ import { DialogStore } from "@/store/module/Dialog";
import { BlinkoEditor } from "../BlinkoEditor";
import { useEffect, useState } from "react";
import { NoteType } from "@/server/types";
import { reaction } from "mobx";

export const BlinkoRightClickMenu = observer(() => {
const { t } = useTranslation();
const blinko = RootStore.Get(BlinkoStore)
const [forceUpdate, setForceUpdate] = useState(0)
const store = RootStore.Local(() => ({
editorHeight: 90,
editBlinko() {
console.log(123)
RootStore.Get(DialogStore).setData({
size: '2xl',
isOpen: true,
Expand All @@ -28,21 +29,16 @@ export const BlinkoRightClickMenu = observer(() => {
})
},
}))
useEffect(() => {
setForceUpdate(forceUpdate + 1)
}, [blinko.curSelectedNote])
return <ContextMenu className='font-bold' id="blink-item-context-menu" hideOnLeave={false} animation="zoom">
<ContextMenuItem onClick={e => {
store.editBlinko()
}}>
<ContextMenuItem onClick={() => { store.editBlinko() }}>
<div className="flex items-start gap-2">
<Icon icon="tabler:edit" width="20" height="20" />
<div>{t('edit')}</div>
</div>
</ContextMenuItem>
<ContextMenuItem onClick={e => {
blinko.isMultiSelectMode = true
blinko.onMultiSelectNote(blinko.curSelectedNote.id)
blinko.onMultiSelectNote(blinko.curSelectedNote?.id!)
}}>
<div className="flex items-start gap-2">
<Icon icon="mingcute:multiselect-line" width="20" height="20" />
Expand All @@ -53,32 +49,32 @@ export const BlinkoRightClickMenu = observer(() => {
<ContextMenuItem
onClick={e => {
blinko.upsertNote.call({
id: blinko.curSelectedNote.id,
type: blinko.curSelectedNote.type == NoteType.NOTE ? NoteType.BLINKO : NoteType.NOTE
id: blinko.curSelectedNote?.id,
type: blinko.curSelectedNote?.type == NoteType.NOTE ? NoteType.BLINKO : NoteType.NOTE
})
}}>
{forceUpdate && <div className="flex items-start gap-2">
<div className="flex items-start gap-2">
<Icon icon="ri:exchange-2-line" width="20" height="20" />
<div>{t('convert-to')} {blinko.curSelectedNote?.type == NoteType.NOTE ?
<span className='text-yellow-500'>{t('blinko')}</span> : <span className='text-blue-500'>{t('note')}</span>}</div>
</div>}
</div>
</ContextMenuItem>

<ContextMenuItem onClick={e => {
blinko.upsertNote.call({ id: blinko.curSelectedNote?.id, isArchived: !blinko.curSelectedNote?.isArchived })
}}>
{forceUpdate && <div className="flex items-start gap-2">
<div className="flex items-start gap-2">
<Icon icon="eva:archive-outline" width="20" height="20" />
{blinko.curSelectedNote?.isArchived ? t('recovery') : t('archive')}
</div>}
</div>
</ContextMenuItem>
<ContextMenuItem className='select-none divider hover:!bg-none'>
<Divider orientation="horizontal" />
</ContextMenuItem>

<ContextMenuItem onClick={async e => {
PromiseCall(api.notes.deleteMany.mutate({ ids: [blinko.curSelectedNote?.id] }))
api.ai.embeddingDelete.mutate({ id: blinko.curSelectedNote?.id })
PromiseCall(api.notes.deleteMany.mutate({ ids: [blinko.curSelectedNote?.id!] }))
api.ai.embeddingDelete.mutate({ id: blinko.curSelectedNote?.id! })
}}>
<div className="flex items-start gap-2 text-red-500">
<Icon icon="mingcute:delete-2-line" width="20" height="20" />
Expand Down
11 changes: 6 additions & 5 deletions src/components/Common/Editor/attachmentsRender.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ import { type Attachment } from '@/server/types';
type IProps = {
files: FileType[]
preview?: boolean
columns?: number
}

const AttachmentsRender = observer(({ files, preview = false }: IProps) => {
const AttachmentsRender = observer(({ files, preview = false, columns = 3 }: IProps) => {
const { t } = useTranslation()
const store = RootStore.Local(() => ({
deleteFile: new PromiseState({
Expand Down Expand Up @@ -51,7 +52,7 @@ const AttachmentsRender = observer(({ files, preview = false }: IProps) => {
})

return <>
<div className='columns-3 md:columns-3'>
<div className={`columns-${columns} md:columns-${columns}`}>
<PhotoProvider>
{files?.filter(i => i.isImage).map((file, index) => (
<div className='relative group'>
Expand Down Expand Up @@ -80,7 +81,7 @@ const AttachmentsRender = observer(({ files, preview = false }: IProps) => {
</PhotoProvider>

</div>
<div className="columns-3 mt-3">
<div className={`columns-${columns} mt-3`}>
{files?.filter(i => !i.isImage).map((file, index) => (
<div onClick={() => {
if (preview) {
Expand All @@ -98,12 +99,12 @@ const AttachmentsRender = observer(({ files, preview = false }: IProps) => {
</>
})

const FilesAttachmentRender = observer(({ files, preview }: { files: Attachment[], preview?: boolean }) => {
const FilesAttachmentRender = observer(({ files, preview, columns }: { files: Attachment[], preview?: boolean, columns?: number }) => {
const [handledFiles, setFiles] = useState<FileType[]>([])
useEffect(() => {
setFiles(HandleFileType(files))
}, [files])
return <AttachmentsRender files={handledFiles} preview={preview} />
return <AttachmentsRender files={handledFiles} preview={preview} columns={columns} />
})

export { AttachmentsRender, FilesAttachmentRender }
Expand Down
12 changes: 9 additions & 3 deletions src/components/Layout/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { use, useEffect, useRef, useState, useTransition } from "react";
import { Avatar, Button, ScrollShadow, Spacer, Image, useDisclosure, Input, Popover, PopoverTrigger, PopoverContent, Card } from "@nextui-org/react";
import { Avatar, Button, ScrollShadow, Spacer, Image, useDisclosure, Input, Popover, PopoverTrigger, PopoverContent, Card, Badge } from "@nextui-org/react";
import { Icon } from "@iconify/react";
import { UserStore } from "@/store/user";
import Link from "next/link";
Expand Down Expand Up @@ -103,7 +103,7 @@ export const CommonLayout = observer(({
<SidebarDrawer className="flex-none" isOpen={isOpen} onOpenChange={e => setisOpen(false)}>
{content}
</SidebarDrawer>
<div className="flex w-full flex-col gap-y-1 sm:max-w-[calc(100%_-_258px)] bg-sencondbackground">
<div className="flex w-full flex-col gap-y-1 sm:max-w-[calc(100%_-_250px)] bg-sencondbackground">
{/* nav bar */}
<header className="flex h-16 min-h-16 items-center justify-between gap-2 rounded-medium px-4 pt-2 pb-2">
<div className="flex max-w-full items-center gap-2 md:p-2 w-full">
Expand All @@ -130,7 +130,7 @@ export const CommonLayout = observer(({
fullWidth
variant="flat"
aria-label="search"
className={`ml-auto w-[150px] md:w-[300px]`}
className={`ml-auto w-[200px] md:w-[300px]`}
classNames={{
base: "px-1 mr-1 w-[full] md:w-[300px]",
inputWrapper:
Expand Down Expand Up @@ -165,6 +165,12 @@ export const CommonLayout = observer(({
</div>
</PopoverContent>
</Popover>
{blinkoStore.dailyReviewNoteList.value?.length != 0 &&
<Badge size="sm" className="mr-2" content={blinkoStore.dailyReviewNoteList.value?.length} color="warning">
<Link href={'/review'}>
<Icon className="mr-2 text-[#8600EF] cursor-pointer" icon="bxs:message-square-detail" width="24" height="24" />
</Link>
</Badge>}
</div>
</div>
{header}
Expand Down
Loading

0 comments on commit 864aaf6

Please sign in to comment.