Skip to content

Commit

Permalink
feat(overlays): move goals inside overlays (#5657)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Goals are moved to be part of overlays, removing their own settings
  • Loading branch information
sogehige committed May 28, 2023
1 parent 8a7c79a commit 0f562f4
Show file tree
Hide file tree
Showing 15 changed files with 327 additions and 433 deletions.
129 changes: 0 additions & 129 deletions src/database/entity/goal.ts

This file was deleted.

146 changes: 144 additions & 2 deletions src/database/entity/overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,62 @@ export interface HTML {
css: string;
}

export interface Goal {
typeId: 'goal';
display: {
type: 'fade';
durationMs: number;
animationInMs: number;
animationOutMs: number;
} | {
type: 'multi';
spaceBetweenGoalsInPx: number;
};
campaigns: {
name: string;
type:
'followers' | 'currentFollowers' | 'currentSubscribers'
| 'subscribers' | 'tips' | 'bits' | 'intervalSubscribers'
| 'intervalFollowers' | 'intervalTips' | 'intervalBits' | 'tiltifyCampaign';
countBitsAsTips: boolean;
display: 'simple' | 'full' | 'custom';
timestamp?: string;
tiltifyCampaign?: number | null,
interval?: 'hour' | 'day' | 'week' | 'month' | 'year';
goalAmount?: number;
currentAmount?: number;
endAfter: string;
endAfterIgnore: boolean;
customization: {
html: string;
js: string;
css: string;
};
customizationBar: {
color: string;
backgroundColor: string;
borderColor: string;
borderPx: number;
height: number;
};
customizationFont: {
family: string;
color: string;
size: number;
weight: number;
borderColor: string;
borderPx: number;
shadow: {
shiftRight: number;
shiftDown: number;
blur: number;
opacity: number;
color: string;
}[];
};
}[];
}

export interface Stats {
typeId: 'stats';
}
Expand Down Expand Up @@ -424,6 +480,92 @@ export class Overlay extends BotEntity<Overlay> {
URL | Chat | Reference | AlertsRegistry | Carousel | Marathon | Stopwatch |
Countdown | Group | Eventlist | EmotesCombo | Credits | Clips | Alerts |
Emotes | EmotesExplode | EmotesFireworks | Polls | TTS | OBSWebsocket |
ClipsCarousel | HypeTrain | Wordcloud | HTML | Stats | Randomizer;
ClipsCarousel | HypeTrain | Wordcloud | HTML | Stats | Randomizer | Goal;
}[];
}
}

// @Entity({ name: "overlay" })
// export class OverlayPlus extends BotEntity<OverlayPlus> {
// @PrimaryColumn({ generated: 'uuid' })
// id: string;

// @Column()
// name: string;

// @Column({ type: (process.env.TYPEORM_CONNECTION ?? 'better-sqlite3') !== 'better-sqlite3' ? 'json' : 'simple-json' })
// canvas: {
// width: number;
// height: number;
// };

// @Column({ type: (process.env.TYPEORM_CONNECTION ?? 'better-sqlite3') !== 'better-sqlite3' ? 'json' : 'simple-json' })
// items: ({
// id: string;
// version: 2;
// isVisible: boolean;
// width: number;
// height: number;
// alignX: number;
// alignY: number;
// rotation: number;
// name: string;
// state: {
// default: {
// box: {
// width: number;
// height: number;
// alignX: number;
// alignY: number;
// rotation: number;
// anchorPos: 'left-top' | 'left-center' | 'left-bottom'
// | 'center-top' | 'center-center' | 'center-bottom'
// | 'right-top' | 'right-right' | 'center-bottom',
// }
// // filter to show based on e.g. follower count, game etc.
// filter: string,
// animation: {
// // animation in is triggered on state show
// animationInDuration: number;
// animationIn: 'fadeIn';
// animationInDelay: number;
// // animation out is triggered on state change (on state hide)
// animationOutDuration: number;
// animationOut: 'fadeOut';
// animationOutDelay: number;
// }
// automation: {
// // next state, if same as current state, do nothing
// goTo: string;
// // how long to change to next state
// delay: number;
// }
// // we just support text item for now
// item: {
// text: string;
// animationText: 'none' | 'baffle' | 'bounce' | 'bounce2' | 'flip' | 'flash' | 'pulse2' | 'rubberBand'
// | 'shake2' | 'swing' | 'tada' | 'wave' | 'wobble' | 'wiggle' | 'wiggle2' | 'jello' | 'typewriter';
// animationTextOptions: {
// speed: number | 'slower' | 'slow' | 'fast' | 'faster';
// maxTimeToDecrypt: number;
// characters: string;
// };
// font: {
// family: string;
// size: number;
// borderPx: number;
// borderColor: string;
// weight: number;
// color: string;
// shadow: {
// shiftRight: number;
// shiftDown: number;
// blur: number;
// opacity: number;
// color: string;
// }[];
// }
// }
// }[]
// }
// })[];
// }
15 changes: 15 additions & 0 deletions src/database/migration/mysql/17.0.x/1678892044033-removeGoal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class removeGoal1678892044033 implements MigrationInterface {
name = 'removeGoal1678892044033';

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP TABLE \`goal\``);
await queryRunner.query(`DROP TABLE \`goal_group\``);
}

public async down(queryRunner: QueryRunner): Promise<void> {
return;
}

}
15 changes: 15 additions & 0 deletions src/database/migration/postgres/17.0.x/1678892044033-removeGoal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class removeGoal1678892044033 implements MigrationInterface {
name = 'removeGoal1678892044033';

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP TABLE "goal"`);
await queryRunner.query(`DROP TABLE "goal_group"`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
return;
}

}
15 changes: 15 additions & 0 deletions src/database/migration/sqlite/17.0.x/1678892044033-removeGoal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class removeGoal1678892044033 implements MigrationInterface {
name = 'removeGoal1678892044033';

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP TABLE "goal_group"`);
await queryRunner.query(`DROP TABLE "goal"`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
return;
}

}

0 comments on commit 0f562f4

Please sign in to comment.