Skip to content

Commit eb527aa

Browse files
committed
Massaga data model towards our prototype.
1 parent a647512 commit eb527aa

File tree

4 files changed

+6
-18
lines changed

4 files changed

+6
-18
lines changed

browser-extension/src/entrypoints/background.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { CommentDraft, CommentEvent, CommentSpot } from '@/lib/enhancer'
1+
import type { CommentEvent, CommentSpot } from '@/lib/enhancer'
22
import type { GetOpenSpotsResponse, ToBackgroundMessage } from '@/lib/messages'
33
import {
44
CLOSE_MESSAGE_PORT,
@@ -15,7 +15,7 @@ export interface Tab {
1515
export interface CommentState {
1616
tab: Tab
1717
spot: CommentSpot
18-
drafts: [number, CommentDraft][]
18+
drafts: [number, string][]
1919
}
2020

2121
export const openSpots = new Map<string, CommentState>()

browser-extension/src/lib/enhancer.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,12 @@ export interface CommentSpot {
1111
type: string
1212
}
1313

14-
export interface CommentDraft {
15-
title?: string
16-
body: string
17-
}
18-
1914
export type CommentEventType = 'ENHANCED' | 'LOST_FOCUS' | 'DESTROYED'
2015

2116
export interface CommentEvent {
2217
type: CommentEventType
2318
spot: CommentSpot
24-
draft?: CommentDraft
19+
draft?: string
2520
}
2621

2722
/** Wraps the textareas of a given platform with Gitcasso's enhancements. */

browser-extension/src/lib/messages.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { CommentDraft, CommentEvent, CommentSpot } from './enhancer'
1+
import type { CommentEvent, CommentSpot } from './enhancer'
22

33
// Message handler response types
44
export const CLOSE_MESSAGE_PORT = false as const // No response will be sent
@@ -31,7 +31,7 @@ export interface GetOpenSpotsResponse {
3131
windowId: number
3232
}
3333
spot: CommentSpot
34-
drafts: Array<[number, CommentDraft]>
34+
drafts: Array<[number, string]>
3535
}>
3636
}
3737

browser-extension/tests/playground/replica.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,7 @@ const gh_issue: GitHubIssueAddCommentSpot = {
2525
const spots: CommentSpot[] = [gh_pr, gh_issue]
2626
const sampleSpots: CommentState[] = spots.map((spot) => {
2727
const state: CommentState = {
28-
drafts: [
29-
[
30-
0,
31-
{
32-
body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
33-
},
34-
],
35-
],
28+
drafts: [[0, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.']],
3629
spot,
3730
tab: {
3831
tabId: 123,

0 commit comments

Comments
 (0)