generated from EasyWebApp/WebCell-scaffold
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[refactor] simplify Announcement types & model
[add] GitHub PR badges
- Loading branch information
Showing
10 changed files
with
75 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
- icon: visualstudio | ||
label: 'GitHub.dev' | ||
message: 'PR-$prNumber' | ||
color: 'blue' | ||
url: 'https://github.dev/$owner/$repo/pull/$prNumber' | ||
|
||
- icon: github | ||
label: 'GitHub codespaces' | ||
message: 'PR-$prNumber' | ||
color: 'black' | ||
url: 'https://codespaces.new/$owner/$repo/pull/$prNumber' | ||
|
||
- icon: git | ||
label: 'GitPod.io' | ||
message: 'PR-$prNumber' | ||
color: 'orange' | ||
url: 'https://gitpod.io/?autostart=true#https://github.com/$owner/$repo/pull/$prNumber' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,26 @@ | ||
import { Base } from '@kaiyuanshe/openhackathon-service'; | ||
import { IDType, ListModel, Stream, toggle } from 'mobx-restful'; | ||
import { buildURLData } from 'web-utility'; | ||
import { Announcement, BaseFilter } from '@kaiyuanshe/openhackathon-service'; | ||
|
||
import { createListStream, Filter, InputData } from '../Base'; | ||
import { Filter, TableModel } from '../Base'; | ||
import { i18n } from '../Base/Translation'; | ||
import sessionStore from '../User/Session'; | ||
|
||
const { t } = i18n; | ||
|
||
export enum MessageType { | ||
export enum AnnouncementType { | ||
Hackathon = 'hackathon', | ||
} | ||
|
||
export const MessageTypeName = () => ({ | ||
[MessageType.Hackathon]: t('hackathon_message'), | ||
export const AnnouncementTypeName = () => ({ | ||
[AnnouncementType.Hackathon]: t('hackathon_message'), | ||
}); | ||
|
||
export interface Message extends Base { | ||
title: string; | ||
content: string; | ||
} | ||
|
||
export type MessageFilter = Filter<Message>; | ||
export type AnnouncementFilter = Filter<Announcement> & BaseFilter; | ||
|
||
export class MessageModel extends Stream<Message, MessageFilter>(ListModel) { | ||
client = sessionStore.client; | ||
|
||
constructor(baseURI: string) { | ||
export class AnnouncementModel extends TableModel< | ||
Announcement, | ||
AnnouncementFilter | ||
> { | ||
constructor(public baseURI: string) { | ||
super(); | ||
this.baseURI = `${baseURI}/announcement`; | ||
} | ||
|
||
openStream(filter: MessageFilter) { | ||
return createListStream<Message>( | ||
`${this.baseURI}s?${buildURLData(filter)}`, | ||
this.client, | ||
count => (this.totalCount = count), | ||
); | ||
} | ||
|
||
@toggle('uploading') | ||
async updateOne(data: InputData<Message>, id?: IDType) { | ||
const { body } = await (id | ||
? this.client.patch<Message>(`${this.baseURI}/${id}`, data) | ||
: this.client.put<Message>(this.baseURI, data)); | ||
return (this.currentOne = body!); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
d35b748
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deploy preview for open-hackathon ready!
✅ Preview
https://open-hackathon-54ukppish-techquerys-projects.vercel.app
Built with commit d35b748.
This pull request is being automatically deployed with vercel-action