Skip to content

Commit

Permalink
feat: finished the marketing week feature MVP
Browse files Browse the repository at this point in the history
  • Loading branch information
darraghoriordan committed Sep 30, 2023
1 parent 663f1f5 commit a250783
Show file tree
Hide file tree
Showing 77 changed files with 501 additions and 284 deletions.
6 changes: 4 additions & 2 deletions src/app/@types/bridge.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import {
DevHistoryGetDayRequest,
GitActivityForMonthRequest,
GitActivityForMonthResponse,
} from '../../electron/devHistory/channels/MessageTypes'
} from '../../electron/marketingWeek/channels/MessageTypes'

declare global {
// eslint-disable-next-line
Expand All @@ -70,7 +70,9 @@ declare global {
}
SimpleMessage: { invoke: (message: string) => void }
OpenFileLocation: { invoke: (filePath: string) => void }

OpenDevHistoryCacheLocation: {
invoke: () => Promise<void>
}
LoadUserSettings: { invoke: () => Promise<UserSettingsResponse> }
SaveUserSettings: {
invoke: (
Expand Down
9 changes: 5 additions & 4 deletions src/app/@types/image.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
declare module '*.png';
declare module '*.jpeg';
declare module '*.jpg';
declare module '*.gif';
declare module '*.png'
declare module '*.jpeg'
declare module '*.jpg'
declare module '*.gif'
declare module '*.svg'
9 changes: 5 additions & 4 deletions src/app/Base64Encoder/Base64EncoderScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import PageHeader from '../components/PageHeader'
import { ArrowDownIcon, DocumentCheckIcon } from '@heroicons/react/24/outline'
import { useEncodeBase64 } from './ReactQueryWrappers'
import { ConsoleContext } from '../ConsoleArea/ConsoleContext'
import { ScreenWrapper } from '../ReusableComponents/ScreenWrapper'

export function Base64EncoderScreen() {
const [logMessages, logAMessage] = useContext(ConsoleContext)
const [_logMessages, logAMessage] = useContext(ConsoleContext)
const encodeBase64Mutation = useEncodeBase64()
const [inputValue, setInputValue] = useState('')
const [encodeToggleValue, setEncodeToggleValue] = useState(false)
Expand Down Expand Up @@ -37,7 +38,7 @@ export function Base64EncoderScreen() {
setOutputValue(result.result)
}
const handleInputKeyDown = async (
event: React.KeyboardEvent<HTMLTextAreaElement>
event: React.KeyboardEvent<HTMLTextAreaElement>,
) => {
if (event.key === 'Enter') {
return runAction()
Expand Down Expand Up @@ -131,7 +132,7 @@ export function Base64EncoderScreen() {
)
}
return (
<div className="mx-auto max-w-10xl">
<ScreenWrapper>
<PageHeader pageTitle={'Base64 Encoder'}>
<button
onClick={e => insertSampleValue(e)}
Expand All @@ -153,6 +154,6 @@ export function Base64EncoderScreen() {
</PageHeader>

{control}
</div>
</ScreenWrapper>
)
}
4 changes: 2 additions & 2 deletions src/app/Base64Encoder/ReactQueryWrappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const wellKnownQueries = {
base64encode: 'base-64-encode',
}
export function useEncodeBase64() {
const [logMessages, logAMessage] = useContext(ConsoleContext)
const [_logMessages, logAMessage] = useContext(ConsoleContext)
return useMutation<
Base64EncoderResponse,
{ message: string },
Expand All @@ -31,6 +31,6 @@ export function useEncodeBase64() {
level: 'info',
})
},
}
},
)
}
17 changes: 7 additions & 10 deletions src/app/ColorConverter/ColorConverterScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
/* eslint-disable jsx-a11y/no-static-element-interactions */
/* eslint-disable jsx-a11y/click-events-have-key-events */
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import React, { ReactElement, useContext, useState } from 'react'
import React, { useContext, useState } from 'react'
import PageHeader from '../components/PageHeader'
import {
ArrowDownIcon,
ClipboardDocumentCheckIcon,
DocumentCheckIcon,
} from '@heroicons/react/24/outline'
import { ArrowDownIcon, DocumentCheckIcon } from '@heroicons/react/24/outline'
import { useColorConverter } from './ReactQueryWrappers'
import { ConsoleContext } from '../ConsoleArea/ConsoleContext'
import { ColorConverterResponse } from '../../electron/colorConverter/channels/MessageTypes'
import { ColorDataItem } from './ColorDataItem'
import ColorItem from './ColorItem'
import { HarmonyColorsSet } from './HarmonyColorSet'
import { ScreenWrapper } from '../ReusableComponents/ScreenWrapper'

export function ColorConverterScreen() {
const [logMessages, logAMessage] = useContext(ConsoleContext)
const [_logMessages, logAMessage] = useContext(ConsoleContext)
const mutation = useColorConverter()
const [inputValue, setInputValue] = useState('')
const [outputValue, setOutputValue] = useState<
ColorConverterResponse | undefined
>()
const handleInputKeyDown = async (
event: React.KeyboardEvent<HTMLInputElement>
event: React.KeyboardEvent<HTMLInputElement>,
) => {
if (event.key === 'Enter') {
return runAction()
Expand Down Expand Up @@ -61,7 +58,7 @@ export function ColorConverterScreen() {
})
}
return (
<div className="mx-auto max-w-10xl">
<ScreenWrapper>
<PageHeader pageTitle={'Color Tool'}>
<button
onClick={e => insertSampleValue(e)}
Expand Down Expand Up @@ -180,6 +177,6 @@ export function ColorConverterScreen() {
</div>
)}
</div>
</div>
</ScreenWrapper>
)
}
4 changes: 2 additions & 2 deletions src/app/ColorConverter/ReactQueryWrappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const wellKnownQueries = {
convertColor: 'convert-color',
}
export function useColorConverter() {
const [logMessages, logAMessage] = useContext(ConsoleContext)
const [_logMessages, logAMessage] = useContext(ConsoleContext)

return useMutation<
ColorConverterResponse,
Expand All @@ -33,6 +33,6 @@ export function useColorConverter() {
level: 'info',
})
},
}
},
)
}
4 changes: 2 additions & 2 deletions src/app/ConsoleArea/Console.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ export const Console = () => {
}, [logMessages])

return (
<div className="self-stretch bg-neutral-800 w-full flex flex-col">
<div className="flex flex-col self-stretch w-full bg-neutral-800">
<div className="flex items-center flex-none text-white border-t-2 border-b-2 bg-neutral-800 border-neutral-600 w-100">
<CommandLineIcon className="w-4 ml-2 text-white" aria-hidden="true" />
<span className="ml-3 font-mono">console</span>
</div>
<div className="pt-2 pl-2 overflow-auto bg-neutral-800">
<div
className="font-mono text-sm whitespace-pre align bg-neutral-800"
className="font-mono text-sm whitespace-pre-wrap align bg-neutral-800"
aria-readonly={true}
aria-label="message console"
>
Expand Down
7 changes: 4 additions & 3 deletions src/app/EslintRuleHelper/EslintRuleGeneratorScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { RemoveButton } from './RemoveButton'
import { GenerationResult } from './GenerationResult'
import { DescriptionAndHelp } from '../components/DescriptionAndHelp'
import { format } from 'date-fns'
import { ScreenWrapper } from '../ReusableComponents/ScreenWrapper'

const faqs = [
{
Expand Down Expand Up @@ -574,8 +575,8 @@ b?: string
)
}
return (
<div className="mx-auto overflow-y-auto max-w-10xl">
<PageHeader pageTitle={'ESLint Rule Generator'}>
<ScreenWrapper>
<PageHeader pageTitle={'ESLint Rule AI Agent'}>
<button
onClick={e => insertComplexSampleValue(e)}
type="button"
Expand Down Expand Up @@ -608,6 +609,6 @@ b?: string
faqs={faqs}
/>
{control}
</div>
</ScreenWrapper>
)
}
8 changes: 4 additions & 4 deletions src/app/EslintRuleHelper/ReactQueryWrappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const wellKnownQueries = {
getPastGeneration: 'eslint-rule-past-generation',
}
export function useEslintRuleGenerator() {
const [logMessages, logAMessage] = useContext(ConsoleContext)
const [_logMessages, logAMessage] = useContext(ConsoleContext)
const queryClient = useQueryClient()
return useMutation<
EslintRuleGenerationRecord,
Expand All @@ -36,7 +36,7 @@ export function useEslintRuleGenerator() {
queryKey: [wellKnownQueries.getPastGenerations],
})
},
}
},
)
}

Expand All @@ -47,7 +47,7 @@ export function useGetPastGenerations() {
{
retry: false,
refetchInterval: 3000,
}
},
)
}
export function useGetPastGeneration(fileName: string) {
Expand All @@ -58,6 +58,6 @@ export function useGetPastGeneration(fileName: string) {
const [key, { fileName }] = queryKey as [string, { fileName: string }]
return window.EslintGetPastGeneration.invoke(fileName)
},
{ retry: false, refetchInterval: 3000 }
{ retry: false, refetchInterval: 3000 },
)
}
14 changes: 5 additions & 9 deletions src/app/GitConfiguration/GitConfigurationListScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import React, { ReactElement, useContext, useEffect } from 'react'
import React, { ReactElement, useContext } from 'react'
import { ArrowPathIcon } from '@heroicons/react/24/solid'
import {
Cog6ToothIcon,
ExclamationTriangleIcon,
FolderOpenIcon,
} from '@heroicons/react/24/outline'
import { FolderOpenIcon } from '@heroicons/react/24/outline'
import PageHeader from '../components/PageHeader'
import GitConfigurationViewCard from './GitConfigurationViewCard'
import { useGetGitConfigurationList, useResetCache } from './ReactQueryWrappers'
Expand Down Expand Up @@ -48,12 +44,12 @@ const faqs = [
]

export function GitConfigurationListScreen() {
const [logMessages, logAMessage] = useContext(ConsoleContext)
const [_logMessages, logAMessage] = useContext(ConsoleContext)

const resetCachesMutation = useResetCache()

const [filter, setFilter] = React.useState<string | undefined>(undefined)
const [debouncedFilter, debounceControl] = useDebounce(filter, 500)
const [debouncedFilter, _debounceControl] = useDebounce(filter, 500)

const { isLoading, data } = useGetGitConfigurationList(debouncedFilter)

Expand All @@ -64,7 +60,7 @@ export function GitConfigurationListScreen() {

const onOpenFolderClick = (
event: React.MouseEvent<HTMLButtonElement>,
location: string
location: string,
) => {
event.preventDefault()
logAMessage({ level: 'info', message: `Opening folder ${location}` })
Expand Down
12 changes: 6 additions & 6 deletions src/app/GitConfiguration/GitConfigurationViewCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ export class GitConfigurationViewCardProps {
}

const GitConfigurationViewCard = (props: GitConfigurationViewCardProps) => {
const [logMessages, logAMessage] = useContext(ConsoleContext)
const origin = props.gitConfigInfo.remotes.find(x =>
x.remoteName?.includes('origin')
const [_logMessages, logAMessage] = useContext(ConsoleContext)
const origin = props.gitConfigInfo.remotes.find(
x => x.remoteName?.includes('origin'),
)
const onOpenSettingsFolderClick = (
event: React.MouseEvent<HTMLButtonElement>
event: React.MouseEvent<HTMLButtonElement>,
) => {
event.preventDefault()

Expand All @@ -31,7 +31,7 @@ const GitConfigurationViewCard = (props: GitConfigurationViewCardProps) => {

const onCopyForGitConfigClick = (
event: React.MouseEvent<HTMLButtonElement>,
value: string
value: string,
) => {
event.preventDefault()

Expand Down Expand Up @@ -99,7 +99,7 @@ const GitConfigurationViewCard = (props: GitConfigurationViewCardProps) => {
onClick={e =>
onCopyForGitConfigClick(
e,
props.gitConfigInfo.userAsIniString || ''
props.gitConfigInfo.userAsIniString || '',
)
}
className="inline-flex items-center px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2"
Expand Down
9 changes: 5 additions & 4 deletions src/app/HtmlEncoder/HtmlEncoderScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import { ArrowDownIcon, DocumentCheckIcon } from '@heroicons/react/24/outline'
import { useEncodeHtmlCharacter } from './ReactQueryWrappers'
import { ConsoleContext } from '../ConsoleArea/ConsoleContext'
import { HtmlEncoderType } from '../../electron/htmlEncoder/HtmlEncoderService'
import { ScreenWrapper } from '../ReusableComponents/ScreenWrapper'

export function HtmlEncoderScreen() {
const [logMessages, logAMessage] = useContext(ConsoleContext)
const [_logMessages, logAMessage] = useContext(ConsoleContext)
const encodeHtmlMutation = useEncodeHtmlCharacter()
const [inputValue, setInputValue] = useState('')
const [encodeToggleValue, setEncodeToggleValue] = useState(true)
Expand Down Expand Up @@ -41,7 +42,7 @@ export function HtmlEncoderScreen() {
setOutputValue(result.result)
}
const handleInputKeyDown = async (
event: React.KeyboardEvent<HTMLTextAreaElement>
event: React.KeyboardEvent<HTMLTextAreaElement>,
) => {
if (event.key === 'Enter') {
return runAction()
Expand Down Expand Up @@ -189,7 +190,7 @@ export function HtmlEncoderScreen() {
)
}
return (
<div className="mx-auto max-w-10xl">
<ScreenWrapper>
<PageHeader pageTitle={'Html Char Encoder'}>
<button
onClick={e => insertSampleValue(e)}
Expand All @@ -211,6 +212,6 @@ export function HtmlEncoderScreen() {
</PageHeader>

{control}
</div>
</ScreenWrapper>
)
}
4 changes: 2 additions & 2 deletions src/app/HtmlEncoder/ReactQueryWrappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const wellKnownQueries = {
htmlEncode: 'html-encode',
}
export function useEncodeHtmlCharacter() {
const [logMessages, logAMessage] = useContext(ConsoleContext)
const [_logMessages, logAMessage] = useContext(ConsoleContext)
return useMutation<
HtmlEncoderResponse,
{ message: string },
Expand All @@ -31,6 +31,6 @@ export function useEncodeHtmlCharacter() {
level: 'info',
})
},
}
},
)
}
Loading

0 comments on commit a250783

Please sign in to comment.