Skip to content

Commit

Permalink
Merge pull request #4 from nukeop/feature/calendar
Browse files Browse the repository at this point in the history
Feature/calendar
  • Loading branch information
nukeop authored Sep 29, 2022
2 parents 0ed3137 + 6d67302 commit 2b8f17e
Show file tree
Hide file tree
Showing 12 changed files with 246 additions and 17 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ In addition to user themes, the repository comes with some custom theme files (i
## Screenshots

![Screenshot 1](./assets/screenshots/screenshot1.png)
![Screenshot 2](./assets/screenshots/screenshot2.png)
![Screenshot 2](./assets/screenshots/screenshot2.png)
![Screenshot 3](./assets/screenshots/screenshot3.png)
Binary file added assets/screenshots/screenshot3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
118 changes: 107 additions & 11 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@trivago/prettier-plugin-sort-imports": "^3.3.0",
"@types/lodash": "^4.14.185",
"@types/react": "^18.0.17",
"@types/react-calendar": "^3.5.3",
"@types/react-dom": "^18.0.6",
"@types/react-virtualized-auto-sizer": "^1.0.1",
"@types/react-window": "^1.8.5",
Expand Down Expand Up @@ -80,6 +81,7 @@
"fuse.js": "^6.6.2",
"glasstron": "^0.1.1",
"lodash": "^4.17.21",
"react-calendar": "^3.9.0",
"react-virtualized-auto-sizer": "^1.0.6",
"react-window": "^1.8.7",
"winston": "^3.8.1",
Expand Down
13 changes: 12 additions & 1 deletion src/bangs/bangs.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// DuckDuckGo style bangs

export type BangResponseType = "infobox" | "value" | "empty";
export type BangResponseType = "infobox" | "widget" | "value" | "empty";

export type BangResponse = {
type: BangResponseType;
Expand All @@ -14,6 +14,11 @@ export interface InfoboxBangResponse extends BangResponse {
type: "infobox";
}

export interface WidgetBangResponse<T> extends BangResponse {
widget: T;
type: "widget";
}

export interface EmptyBangResponse extends BangResponse {
type: "empty";
}
Expand All @@ -24,6 +29,12 @@ export const isInfoboxBangResponse = (
return response?.type === "infobox";
};

export const isWidgetBangResponse = (
response: BangResponse | void
): response is WidgetBangResponse<any> => {
return response?.type === "widget";
};

export const isEmptyBangResponse = (
response: BangResponse | void
): response is EmptyBangResponse => {
Expand Down
14 changes: 14 additions & 0 deletions src/bangs/calendar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Calendar } from "../components/Calendar/Calendar";
import { EmptyBangResponse, IBang, WidgetBangResponse } from "./bangs";

export class CalendarBang
implements IBang<WidgetBangResponse<typeof Calendar> | EmptyBangResponse>
{
isPresent(input: string) {
return input.includes("!cal");
}

async onActivate(input: string) {
return { widget: Calendar, type: "widget" as const };
}
}
Loading

0 comments on commit 2b8f17e

Please sign in to comment.