From a2507832c62c1bca65e6241149a551ba9209c89b Mon Sep 17 00:00:00 2001 From: Darragh ORiordan Date: Sat, 30 Sep 2023 22:21:00 +1000 Subject: [PATCH] feat: finished the marketing week feature MVP --- src/app/@types/bridge.d.ts | 6 +- src/app/@types/image.d.ts | 9 +- src/app/Base64Encoder/Base64EncoderScreen.tsx | 9 +- src/app/Base64Encoder/ReactQueryWrappers.ts | 4 +- .../ColorConverter/ColorConverterScreen.tsx | 17 ++-- src/app/ColorConverter/ReactQueryWrappers.ts | 4 +- src/app/ConsoleArea/Console.tsx | 4 +- .../EslintRuleGeneratorScreen.tsx | 7 +- .../EslintRuleHelper/ReactQueryWrappers.ts | 8 +- .../GitConfigurationListScreen.tsx | 14 ++- .../GitConfigurationViewCard.tsx | 12 +-- src/app/HtmlEncoder/HtmlEncoderScreen.tsx | 9 +- src/app/HtmlEncoder/ReactQueryWrappers.ts | 4 +- src/app/JsonEscaper/JsonEscaperScreen.tsx | 9 +- src/app/JsonEscaper/ReactQueryWrappers.ts | 4 +- src/app/JwtDecoder/JwtDecoderScreen.tsx | 13 +-- src/app/JwtDecoder/ReactQueryWrappers.ts | 4 +- src/app/Licensing/LicenseKeyForm.tsx | 2 +- src/app/Licensing/LicensingScreen.tsx | 7 +- src/app/Licensing/ReactQueryWrappers.ts | 6 +- src/app/MarketingWeek/Calendar.tsx | 11 ++- .../Components/BlogPostsDetailsSummary.tsx | 4 +- .../MarketingWeek/Components/DateActions.tsx | 12 ++- .../MarketingWeek/Components/LinkedInPost.tsx | 49 +++++++++++ .../MarketingWeek/Components/ScheduleItem.tsx | 2 +- .../Components/SocialPostsDetailsSummary.tsx | 87 +++---------------- .../MarketingWeek/Components/TwitterPost.tsx | 62 +++++++++++++ src/app/MarketingWeek/Components/clap.svg | 24 +++++ src/app/MarketingWeek/Components/colorMap.ts | 2 +- src/app/MarketingWeek/Components/heart.svg | 10 +++ src/app/MarketingWeek/Components/thumbup.svg | 8 ++ src/app/MarketingWeek/MarketingWeekScreen.tsx | 46 +++++----- src/app/MarketingWeek/ReactQueryWrappers.ts | 12 ++- src/app/Onboarding/OnboardingScreen.tsx | 7 +- src/app/Onboarding/hooks.ts | 2 +- src/app/ReusableComponents/ScreenWrapper.tsx | 9 ++ src/app/SshUrlConverter/ReactQueryWrappers.ts | 4 +- .../SshUrlConverter/SshUrlConverterScreen.tsx | 19 ++-- .../StringCaseConverter/ReactQueryWrappers.ts | 4 +- .../StringCaseConverterScreen.tsx | 9 +- src/app/StringSorter/ReactQueryWrappers.ts | 4 +- src/app/StringSorter/StringSorterScreen.tsx | 7 +- .../TimestampConverter/ReactQueryWrappers.ts | 4 +- .../TimeStampConverterScreen.tsx | 11 +-- src/app/UrlEscaper/ReactQueryWrappers.ts | 4 +- src/app/UrlEscaper/UrlEncoderScreen.tsx | 11 +-- src/app/UserSettings/BooleanField.tsx | 39 +++++++++ .../SettingPathSelectionField.tsx | 3 - src/app/UserSettings/SettingTextField.tsx | 3 - src/app/UserSettings/SettingsForm.tsx | 34 +++++--- src/app/UserSettings/SettingsFormSection.tsx | 3 - src/app/UserSettings/SettingsScreen.tsx | 40 ++++----- src/app/components/SidebarMenu.tsx | 2 +- src/electron/channelConfigurationsPubs.ts | 6 +- src/electron/channelConfigurationsSubs.ts | 6 +- .../channels/DevHistoryChannelEnum.ts | 1 + .../channels/DevHistoryGetDayChannelPub.ts | 0 .../channels/DevHistoryGetDayChannelSub.ts | 3 +- .../channels/GitActivityForMonthChannelPub.ts | 0 .../channels/GitActivityForMonthChannelSub.ts | 21 +++++ .../channels/MessageTypes.ts | 0 .../OpenDevHistoryCacheLocationPub.ts | 8 ++ .../OpenDevHistoryCacheLocationSub.ts | 16 ++++ .../models/HistoryEntry.ts | 0 .../models/IncrementAnalysis.ts | 0 .../services/chrome-browser-history.ts | 0 .../services/day-analyser.ts | 1 + .../services/dev-history-cache.ts | 14 ++- .../services/git-repository-history.test.ts | 0 .../services/git-repository-history.ts | 0 .../services/month-analyser-cache.ts | 0 .../services/month-analyser.ts | 0 .../services/notEmpty.ts | 0 .../services/openai-service.ts | 7 +- .../services/time-wrangler.test.ts | 0 .../services/time-wrangler.ts | 0 webpack.rules.js | 2 +- 77 files changed, 501 insertions(+), 284 deletions(-) create mode 100644 src/app/MarketingWeek/Components/LinkedInPost.tsx create mode 100644 src/app/MarketingWeek/Components/TwitterPost.tsx create mode 100644 src/app/MarketingWeek/Components/clap.svg create mode 100644 src/app/MarketingWeek/Components/heart.svg create mode 100644 src/app/MarketingWeek/Components/thumbup.svg create mode 100644 src/app/ReusableComponents/ScreenWrapper.tsx create mode 100644 src/app/UserSettings/BooleanField.tsx rename src/electron/{devHistory => marketingWeek}/channels/DevHistoryChannelEnum.ts (76%) rename src/electron/{devHistory => marketingWeek}/channels/DevHistoryGetDayChannelPub.ts (100%) rename src/electron/{devHistory => marketingWeek}/channels/DevHistoryGetDayChannelSub.ts (89%) rename src/electron/{devHistory => marketingWeek}/channels/GitActivityForMonthChannelPub.ts (100%) rename src/electron/{devHistory => marketingWeek}/channels/GitActivityForMonthChannelSub.ts (56%) rename src/electron/{devHistory => marketingWeek}/channels/MessageTypes.ts (100%) create mode 100644 src/electron/marketingWeek/channels/OpenDevHistoryCacheLocationPub.ts create mode 100644 src/electron/marketingWeek/channels/OpenDevHistoryCacheLocationSub.ts rename src/electron/{devHistory => marketingWeek}/models/HistoryEntry.ts (100%) rename src/electron/{devHistory => marketingWeek}/models/IncrementAnalysis.ts (100%) rename src/electron/{devHistory => marketingWeek}/services/chrome-browser-history.ts (100%) rename src/electron/{devHistory => marketingWeek}/services/day-analyser.ts (99%) rename src/electron/{devHistory => marketingWeek}/services/dev-history-cache.ts (76%) rename src/electron/{devHistory => marketingWeek}/services/git-repository-history.test.ts (100%) rename src/electron/{devHistory => marketingWeek}/services/git-repository-history.ts (100%) rename src/electron/{devHistory => marketingWeek}/services/month-analyser-cache.ts (100%) rename src/electron/{devHistory => marketingWeek}/services/month-analyser.ts (100%) rename src/electron/{devHistory => marketingWeek}/services/notEmpty.ts (100%) rename src/electron/{devHistory => marketingWeek}/services/openai-service.ts (98%) rename src/electron/{devHistory => marketingWeek}/services/time-wrangler.test.ts (100%) rename src/electron/{devHistory => marketingWeek}/services/time-wrangler.ts (100%) diff --git a/src/app/@types/bridge.d.ts b/src/app/@types/bridge.d.ts index 5c27684..c4e0ff0 100644 --- a/src/app/@types/bridge.d.ts +++ b/src/app/@types/bridge.d.ts @@ -59,7 +59,7 @@ import { DevHistoryGetDayRequest, GitActivityForMonthRequest, GitActivityForMonthResponse, -} from '../../electron/devHistory/channels/MessageTypes' +} from '../../electron/marketingWeek/channels/MessageTypes' declare global { // eslint-disable-next-line @@ -70,7 +70,9 @@ declare global { } SimpleMessage: { invoke: (message: string) => void } OpenFileLocation: { invoke: (filePath: string) => void } - + OpenDevHistoryCacheLocation: { + invoke: () => Promise + } LoadUserSettings: { invoke: () => Promise } SaveUserSettings: { invoke: ( diff --git a/src/app/@types/image.d.ts b/src/app/@types/image.d.ts index 9ddf0c3..60f9d3b 100644 --- a/src/app/@types/image.d.ts +++ b/src/app/@types/image.d.ts @@ -1,4 +1,5 @@ -declare module '*.png'; -declare module '*.jpeg'; -declare module '*.jpg'; -declare module '*.gif'; \ No newline at end of file +declare module '*.png' +declare module '*.jpeg' +declare module '*.jpg' +declare module '*.gif' +declare module '*.svg' diff --git a/src/app/Base64Encoder/Base64EncoderScreen.tsx b/src/app/Base64Encoder/Base64EncoderScreen.tsx index 5cc3483..6b98936 100644 --- a/src/app/Base64Encoder/Base64EncoderScreen.tsx +++ b/src/app/Base64Encoder/Base64EncoderScreen.tsx @@ -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) @@ -37,7 +38,7 @@ export function Base64EncoderScreen() { setOutputValue(result.result) } const handleInputKeyDown = async ( - event: React.KeyboardEvent + event: React.KeyboardEvent, ) => { if (event.key === 'Enter') { return runAction() @@ -131,7 +132,7 @@ export function Base64EncoderScreen() { ) } return ( -
+
+ ) } diff --git a/src/app/Base64Encoder/ReactQueryWrappers.ts b/src/app/Base64Encoder/ReactQueryWrappers.ts index b6c4ae2..ea16587 100644 --- a/src/app/Base64Encoder/ReactQueryWrappers.ts +++ b/src/app/Base64Encoder/ReactQueryWrappers.ts @@ -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 }, @@ -31,6 +31,6 @@ export function useEncodeBase64() { level: 'info', }) }, - } + }, ) } diff --git a/src/app/ColorConverter/ColorConverterScreen.tsx b/src/app/ColorConverter/ColorConverterScreen.tsx index 14dc82a..97ebfb1 100644 --- a/src/app/ColorConverter/ColorConverterScreen.tsx +++ b/src/app/ColorConverter/ColorConverterScreen.tsx @@ -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 + event: React.KeyboardEvent, ) => { if (event.key === 'Enter') { return runAction() @@ -61,7 +58,7 @@ export function ColorConverterScreen() { }) } return ( -
+
)} - + ) } diff --git a/src/app/ColorConverter/ReactQueryWrappers.ts b/src/app/ColorConverter/ReactQueryWrappers.ts index e907d1c..e155458 100644 --- a/src/app/ColorConverter/ReactQueryWrappers.ts +++ b/src/app/ColorConverter/ReactQueryWrappers.ts @@ -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, @@ -33,6 +33,6 @@ export function useColorConverter() { level: 'info', }) }, - } + }, ) } diff --git a/src/app/ConsoleArea/Console.tsx b/src/app/ConsoleArea/Console.tsx index 69aa067..feb0c17 100644 --- a/src/app/ConsoleArea/Console.tsx +++ b/src/app/ConsoleArea/Console.tsx @@ -17,14 +17,14 @@ export const Console = () => { }, [logMessages]) return ( -
+
diff --git a/src/app/EslintRuleHelper/EslintRuleGeneratorScreen.tsx b/src/app/EslintRuleHelper/EslintRuleGeneratorScreen.tsx index f060d1e..ffe097e 100644 --- a/src/app/EslintRuleHelper/EslintRuleGeneratorScreen.tsx +++ b/src/app/EslintRuleHelper/EslintRuleGeneratorScreen.tsx @@ -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 = [ { @@ -574,8 +575,8 @@ b?: string ) } return ( -
- + +
+ ) } diff --git a/src/app/EslintRuleHelper/ReactQueryWrappers.ts b/src/app/EslintRuleHelper/ReactQueryWrappers.ts index 2a5d270..4216fcf 100644 --- a/src/app/EslintRuleHelper/ReactQueryWrappers.ts +++ b/src/app/EslintRuleHelper/ReactQueryWrappers.ts @@ -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, @@ -36,7 +36,7 @@ export function useEslintRuleGenerator() { queryKey: [wellKnownQueries.getPastGenerations], }) }, - } + }, ) } @@ -47,7 +47,7 @@ export function useGetPastGenerations() { { retry: false, refetchInterval: 3000, - } + }, ) } export function useGetPastGeneration(fileName: string) { @@ -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 }, ) } diff --git a/src/app/GitConfiguration/GitConfigurationListScreen.tsx b/src/app/GitConfiguration/GitConfigurationListScreen.tsx index 74667e2..0cba68d 100644 --- a/src/app/GitConfiguration/GitConfigurationListScreen.tsx +++ b/src/app/GitConfiguration/GitConfigurationListScreen.tsx @@ -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' @@ -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(undefined) - const [debouncedFilter, debounceControl] = useDebounce(filter, 500) + const [debouncedFilter, _debounceControl] = useDebounce(filter, 500) const { isLoading, data } = useGetGitConfigurationList(debouncedFilter) @@ -64,7 +60,7 @@ export function GitConfigurationListScreen() { const onOpenFolderClick = ( event: React.MouseEvent, - location: string + location: string, ) => { event.preventDefault() logAMessage({ level: 'info', message: `Opening folder ${location}` }) diff --git a/src/app/GitConfiguration/GitConfigurationViewCard.tsx b/src/app/GitConfiguration/GitConfigurationViewCard.tsx index 87ac3d3..108dd86 100644 --- a/src/app/GitConfiguration/GitConfigurationViewCard.tsx +++ b/src/app/GitConfiguration/GitConfigurationViewCard.tsx @@ -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 + event: React.MouseEvent, ) => { event.preventDefault() @@ -31,7 +31,7 @@ const GitConfigurationViewCard = (props: GitConfigurationViewCardProps) => { const onCopyForGitConfigClick = ( event: React.MouseEvent, - value: string + value: string, ) => { event.preventDefault() @@ -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" diff --git a/src/app/HtmlEncoder/HtmlEncoderScreen.tsx b/src/app/HtmlEncoder/HtmlEncoderScreen.tsx index f0a2451..0498151 100644 --- a/src/app/HtmlEncoder/HtmlEncoderScreen.tsx +++ b/src/app/HtmlEncoder/HtmlEncoderScreen.tsx @@ -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) @@ -41,7 +42,7 @@ export function HtmlEncoderScreen() { setOutputValue(result.result) } const handleInputKeyDown = async ( - event: React.KeyboardEvent + event: React.KeyboardEvent, ) => { if (event.key === 'Enter') { return runAction() @@ -189,7 +190,7 @@ export function HtmlEncoderScreen() { ) } return ( -
+
+ ) } diff --git a/src/app/HtmlEncoder/ReactQueryWrappers.ts b/src/app/HtmlEncoder/ReactQueryWrappers.ts index 7b45103..7bb0126 100644 --- a/src/app/HtmlEncoder/ReactQueryWrappers.ts +++ b/src/app/HtmlEncoder/ReactQueryWrappers.ts @@ -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 }, @@ -31,6 +31,6 @@ export function useEncodeHtmlCharacter() { level: 'info', }) }, - } + }, ) } diff --git a/src/app/JsonEscaper/JsonEscaperScreen.tsx b/src/app/JsonEscaper/JsonEscaperScreen.tsx index d0b62fd..34126f5 100644 --- a/src/app/JsonEscaper/JsonEscaperScreen.tsx +++ b/src/app/JsonEscaper/JsonEscaperScreen.tsx @@ -4,13 +4,14 @@ import PageHeader from '../components/PageHeader' import { useEscapeJson } from './ReactQueryWrappers' import { ArrowDownIcon, DocumentCheckIcon } from '@heroicons/react/24/outline' import { ConsoleContext } from '../ConsoleArea/ConsoleContext' +import { ScreenWrapper } from '../ReusableComponents/ScreenWrapper' export function JsonEscaperScreen() { const escapeJsonMutation = useEscapeJson() const [inputValue, setInputValue] = useState('') const [unescapeToggleValue, setUnescapeToggleValue] = useState(true) const [outputValue, setOutputValue] = useState('') - const [logMessages, logAMessage] = useContext(ConsoleContext) + const [_logMessages, logAMessage] = useContext(ConsoleContext) let control: ReactElement | undefined = undefined const onDecodeClick = async (event: React.MouseEvent) => { @@ -36,7 +37,7 @@ export function JsonEscaperScreen() { setInputValue( // eslint-disable-next-line no-useless-escape // prettier-ignore - `{\\"this\\":\\"isescaped\\"}` + `{\\"this\\":\\"isescaped\\"}`, ) } @@ -122,7 +123,7 @@ export function JsonEscaperScreen() { ) } return ( -
+
+ ) } diff --git a/src/app/JsonEscaper/ReactQueryWrappers.ts b/src/app/JsonEscaper/ReactQueryWrappers.ts index 5c3e087..24098a5 100644 --- a/src/app/JsonEscaper/ReactQueryWrappers.ts +++ b/src/app/JsonEscaper/ReactQueryWrappers.ts @@ -10,7 +10,7 @@ export const wellKnownQueries = { escapeJson: 'escape-json', } export function useEscapeJson() { - const [logMessages, logAMessage] = useContext(ConsoleContext) + const [_logMessages, logAMessage] = useContext(ConsoleContext) return useMutation< EscapeJsonResponse, @@ -32,6 +32,6 @@ export function useEscapeJson() { level: 'info', }) }, - } + }, ) } diff --git a/src/app/JwtDecoder/JwtDecoderScreen.tsx b/src/app/JwtDecoder/JwtDecoderScreen.tsx index df979b5..b4c0dc7 100644 --- a/src/app/JwtDecoder/JwtDecoderScreen.tsx +++ b/src/app/JwtDecoder/JwtDecoderScreen.tsx @@ -4,12 +4,13 @@ import PageHeader from '../components/PageHeader' import { useDecodeJwt } from './ReactQueryWrappers' import { ArrowDownIcon, DocumentCheckIcon } from '@heroicons/react/24/outline' import { ConsoleContext } from '../ConsoleArea/ConsoleContext' +import { ScreenWrapper } from '../ReusableComponents/ScreenWrapper' export function JwtDecoderScreen() { const decodeJwtMutation = useDecodeJwt() const [inputValue, setInputValue] = useState('') const [outputValue, setOutputValue] = useState('') - const [logMessages, logAMessage] = useContext(ConsoleContext) + const [_logMessages, logAMessage] = useContext(ConsoleContext) const onDecodeClick = async (event: React.MouseEvent) => { event.preventDefault() @@ -24,19 +25,19 @@ export function JwtDecoderScreen() { JSON.stringify( { header: result.algorithm, payload: result.payload }, null, - 2 - ) + 2, + ), ) } const insertSampleValue = (event: React.MouseEvent) => { event.preventDefault() setInputValue( - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0b3B0YWwuY29tIiwiZXhwIjoxNDI2NDIwODAwLCJodHRwOi8vdG9wdGFsLmNvbS9qd3RfY2xhaW1zL2lzX2FkbWluIjp0cnVlLCJjb21wYW55IjoiVG9wdGFsIiwiYXdlc29tZSI6dHJ1ZX0.yRQYnWzskCZUxPwaQupWkiUzKELZ49eM7oWxAQK_ZXw' + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0b3B0YWwuY29tIiwiZXhwIjoxNDI2NDIwODAwLCJodHRwOi8vdG9wdGFsLmNvbS9qd3RfY2xhaW1zL2lzX2FkbWluIjp0cnVlLCJjb21wYW55IjoiVG9wdGFsIiwiYXdlc29tZSI6dHJ1ZX0.yRQYnWzskCZUxPwaQupWkiUzKELZ49eM7oWxAQK_ZXw', ) } return ( -
+
-
+ ) } diff --git a/src/app/JwtDecoder/ReactQueryWrappers.ts b/src/app/JwtDecoder/ReactQueryWrappers.ts index 13e4bab..71e6a16 100644 --- a/src/app/JwtDecoder/ReactQueryWrappers.ts +++ b/src/app/JwtDecoder/ReactQueryWrappers.ts @@ -10,7 +10,7 @@ export const wellKnownQueries = { decodeJwt: 'decode-jwt', } export function useDecodeJwt() { - const [logMessages, logAMessage] = useContext(ConsoleContext) + const [_logMessages, logAMessage] = useContext(ConsoleContext) return useMutation< DecodeJwtResponse, @@ -32,6 +32,6 @@ export function useDecodeJwt() { level: 'info', }) }, - } + }, ) } diff --git a/src/app/Licensing/LicenseKeyForm.tsx b/src/app/Licensing/LicenseKeyForm.tsx index 5f12710..ee7f49e 100644 --- a/src/app/Licensing/LicenseKeyForm.tsx +++ b/src/app/Licensing/LicenseKeyForm.tsx @@ -4,7 +4,7 @@ import { ConsoleContext } from '../ConsoleArea/ConsoleContext' import { useSetLicensing } from './ReactQueryWrappers' export const LicenseKeyForm = () => { - const [logMessages, logAMessage] = useContext(ConsoleContext) + const [_logMessages, logAMessage] = useContext(ConsoleContext) const setLicense = useSetLicensing() const { register, diff --git a/src/app/Licensing/LicensingScreen.tsx b/src/app/Licensing/LicensingScreen.tsx index f5db6fd..f6a1bd5 100644 --- a/src/app/Licensing/LicensingScreen.tsx +++ b/src/app/Licensing/LicensingScreen.tsx @@ -9,8 +9,9 @@ import { LicenseDisplay } from './LicenseDisplay' import { TrialDisplay } from './TrialDisplay' import { CTADisplayOld } from './CTADisplayOld' import { CTADisplayManualElements } from './CTADisplayManualElements' +import { ScreenWrapper } from '../ReusableComponents/ScreenWrapper' export const LicensingScreen = () => { - const [logMessages, logAMessage] = useContext(ConsoleContext) + const [_logMessages, logAMessage] = useContext(ConsoleContext) const { isLoading, data, error } = useGetLicensing() @@ -19,7 +20,7 @@ export const LicensingScreen = () => { } return ( -
+ {data.licenseKey && !data.mustEnterLicenseKey && (
@@ -52,6 +53,6 @@ export const LicensingScreen = () => {
)} -
+ ) } diff --git a/src/app/Licensing/ReactQueryWrappers.ts b/src/app/Licensing/ReactQueryWrappers.ts index 96e4c54..e6a9f08 100644 --- a/src/app/Licensing/ReactQueryWrappers.ts +++ b/src/app/Licensing/ReactQueryWrappers.ts @@ -18,12 +18,12 @@ export function useGetLicensing() { { staleTime: Infinity, retry: false, - } + }, ) } export function useSetLicensing() { - const [logMessages, logAMessage] = useContext(ConsoleContext) + const [_logMessages, logAMessage] = useContext(ConsoleContext) const queryClient = useQueryClient() return useMutation< @@ -51,6 +51,6 @@ export function useSetLicensing() { }) queryClient.resetQueries([wellKnownQueries.loadLicensingData]) }, - } + }, ) } diff --git a/src/app/MarketingWeek/Calendar.tsx b/src/app/MarketingWeek/Calendar.tsx index a02adff..ef5d402 100644 --- a/src/app/MarketingWeek/Calendar.tsx +++ b/src/app/MarketingWeek/Calendar.tsx @@ -1,7 +1,7 @@ /* eslint-disable jsx-a11y/anchor-is-valid */ import React, { Fragment, useEffect, useRef } from 'react' import { ChevronLeftIcon, ChevronRightIcon } from '@heroicons/react/20/solid' -import { IncrementAnalysis } from '../../electron/devHistory/models/IncrementAnalysis' +import { IncrementAnalysis } from '../../electron/marketingWeek/models/IncrementAnalysis' import { ScheduledItem } from './Components/ScheduleItem' import { eachDayOfInterval, @@ -140,7 +140,10 @@ export default function Calendar({ return (
-
+
-
+
diff --git a/src/app/MarketingWeek/Components/BlogPostsDetailsSummary.tsx b/src/app/MarketingWeek/Components/BlogPostsDetailsSummary.tsx index 2afc348..0b8e0f0 100644 --- a/src/app/MarketingWeek/Components/BlogPostsDetailsSummary.tsx +++ b/src/app/MarketingWeek/Components/BlogPostsDetailsSummary.tsx @@ -9,7 +9,7 @@ export function BlogPostsDetailsSummary({ return (
- 0 Generated Blog Posts + 0 Draft Blog Posts
No posts for this time period @@ -21,7 +21,7 @@ export function BlogPostsDetailsSummary({ return (
- {blogPosts?.length || '0'} Generated Blog Posts + {blogPosts?.length || '0'} Draft Blog Posts {blogPosts?.map((post, index) => { diff --git a/src/app/MarketingWeek/Components/DateActions.tsx b/src/app/MarketingWeek/Components/DateActions.tsx index 13b1ffd..1a31772 100644 --- a/src/app/MarketingWeek/Components/DateActions.tsx +++ b/src/app/MarketingWeek/Components/DateActions.tsx @@ -6,12 +6,12 @@ import { XMarkIcon, } from '@heroicons/react/24/outline' import { Fragment } from 'react' -import { IncrementAnalysis } from '../../../electron/devHistory/models/IncrementAnalysis' +import { IncrementAnalysis } from '../../../electron/marketingWeek/models/IncrementAnalysis' import { colorMap } from './colorMap' import { BrowserHistoryEntry, GitCommitHistoryEntry, -} from '../../../electron/devHistory/models/HistoryEntry' +} from '../../../electron/marketingWeek/models/HistoryEntry' import { SocialPostsDetailsSummary } from './SocialPostsDetailsSummary' import { BlogPostsDetailsSummary } from './BlogPostsDetailsSummary' @@ -145,7 +145,11 @@ export default function DateActions({ className="list-inside" > -

{gitMeta.message}

+

+ {gitMeta.repository + + ' | ' + + gitMeta.message} +

) })} @@ -159,7 +163,7 @@ export default function DateActions({
diff --git a/src/app/MarketingWeek/Components/LinkedInPost.tsx b/src/app/MarketingWeek/Components/LinkedInPost.tsx new file mode 100644 index 0000000..cd12879 --- /dev/null +++ b/src/app/MarketingWeek/Components/LinkedInPost.tsx @@ -0,0 +1,49 @@ +import { UserCircleIcon } from '@heroicons/react/24/outline' +import clap from './clap.svg' +import heart from './heart.svg' +import thumb from './thumbup.svg' + +export function LinkedInPost({ text }: { text: string }) { + return ( + //
+
+
+ +
+
+ Marketing Week + • 1st +
+
+ Software Engineer at Marketing Week, Inc +
+
+ 3d • Edited • + + + +
+
+
+

+ {text} +

+
+ linkedin icon + linkedin icon + linkedin icon + 47 • 26 comments +
+
+ //
+ ) +} diff --git a/src/app/MarketingWeek/Components/ScheduleItem.tsx b/src/app/MarketingWeek/Components/ScheduleItem.tsx index 364079b..2159fc8 100644 --- a/src/app/MarketingWeek/Components/ScheduleItem.tsx +++ b/src/app/MarketingWeek/Components/ScheduleItem.tsx @@ -1,6 +1,6 @@ /* eslint-disable jsx-a11y/anchor-is-valid */ import { AtSymbolIcon, PencilSquareIcon } from '@heroicons/react/24/outline' -import { IncrementAnalysis } from '../../../electron/devHistory/models/IncrementAnalysis' +import { IncrementAnalysis } from '../../../electron/marketingWeek/models/IncrementAnalysis' import { colorMap, defaultColor } from './colorMap' export function ScheduledItem({ diff --git a/src/app/MarketingWeek/Components/SocialPostsDetailsSummary.tsx b/src/app/MarketingWeek/Components/SocialPostsDetailsSummary.tsx index ca0edc1..3ccc861 100644 --- a/src/app/MarketingWeek/Components/SocialPostsDetailsSummary.tsx +++ b/src/app/MarketingWeek/Components/SocialPostsDetailsSummary.tsx @@ -1,17 +1,16 @@ -import { UserCircleIcon } from '@heroicons/react/24/outline' -import { format } from 'date-fns' +import { LinkedInPost } from './LinkedInPost' +import { TwitterPost } from './TwitterPost' export function SocialPostsDetailsSummary({ - tweets, + socialPosts, }: { - tweets: { text: string }[] + socialPosts: { text: string }[] }) { - const nowInTwitterFormat = format(new Date(), 'h:mm a · MMM d, yyyy') - if (tweets.length === 0) { + if (socialPosts.length === 0) { return (
- 0 Generated Tweets / Social Posts + 0 Draft Tweets / Social Posts
No tweets for this time period @@ -22,76 +21,14 @@ export function SocialPostsDetailsSummary({ return (
- {tweets.length} Generated Tweets / Social Posts + {socialPosts.length} Draft Tweets / Social Posts
- {tweets?.map((post, index) => { - return ( -
-
-
- -
- - Marketing Week - - - - @marketingWeek - -
-
- - - - - -
-

- {post.text} -

- -

- {nowInTwitterFormat} -

-
-
-
- - - - - - 615 -
-
- - - - - - - 93 people are Tweeting about this - -
-
-
- ) + {socialPosts?.map((post, index) => { + if (index % 2 === 0) { + return + } + return })}
diff --git a/src/app/MarketingWeek/Components/TwitterPost.tsx b/src/app/MarketingWeek/Components/TwitterPost.tsx new file mode 100644 index 0000000..d9a8644 --- /dev/null +++ b/src/app/MarketingWeek/Components/TwitterPost.tsx @@ -0,0 +1,62 @@ +import { UserCircleIcon } from '@heroicons/react/24/outline' +import { format } from 'date-fns' + +export function TwitterPost({ text }: { text: string }) { + const nowInTwitterFormat = format(new Date(), 'h:mm a · MMM d, yyyy') + return ( +
+
+
+ +
+ + Marketing Week + + + + @marketingWeek + +
+
+ + + + + +
+

+ {text} +

+ +

+ {nowInTwitterFormat} +

+
+
+
+ + + + + + 615 +
+
+ + + + + + 93 people are Tweeting about this +
+
+
+ ) +} diff --git a/src/app/MarketingWeek/Components/clap.svg b/src/app/MarketingWeek/Components/clap.svg new file mode 100644 index 0000000..d691e5d --- /dev/null +++ b/src/app/MarketingWeek/Components/clap.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/app/MarketingWeek/Components/colorMap.ts b/src/app/MarketingWeek/Components/colorMap.ts index 58998f4..ce9f04d 100644 --- a/src/app/MarketingWeek/Components/colorMap.ts +++ b/src/app/MarketingWeek/Components/colorMap.ts @@ -1,4 +1,4 @@ -import { CategoryEnum } from '../../../electron/devHistory/services/openai-service' +import { CategoryEnum } from '../../../electron/marketingWeek/services/openai-service' export const defaultColor = { text: 'text-stone-500', diff --git a/src/app/MarketingWeek/Components/heart.svg b/src/app/MarketingWeek/Components/heart.svg new file mode 100644 index 0000000..d2d0a80 --- /dev/null +++ b/src/app/MarketingWeek/Components/heart.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/app/MarketingWeek/Components/thumbup.svg b/src/app/MarketingWeek/Components/thumbup.svg new file mode 100644 index 0000000..d5c7a6a --- /dev/null +++ b/src/app/MarketingWeek/Components/thumbup.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/app/MarketingWeek/MarketingWeekScreen.tsx b/src/app/MarketingWeek/MarketingWeekScreen.tsx index 4cdcb07..c685a2a 100644 --- a/src/app/MarketingWeek/MarketingWeekScreen.tsx +++ b/src/app/MarketingWeek/MarketingWeekScreen.tsx @@ -3,7 +3,7 @@ import React, { ReactElement, useContext } from 'react' import PageHeader from '../components/PageHeader' import { AtSymbolIcon, - DocumentCheckIcon, + FolderOpenIcon, PencilSquareIcon, } from '@heroicons/react/24/outline' import { useDevHistoryGetDay } from './ReactQueryWrappers' @@ -11,9 +11,11 @@ import { ConsoleContext } from '../ConsoleArea/ConsoleContext' import Calendar from './Calendar' import { DiscreteDayNav } from './Components/DiscreteDayNav' import DateActions from './Components/DateActions' -import { IncrementAnalysis } from '../../electron/devHistory/models/IncrementAnalysis' -import { timeOfDayMatchesToSecond } from '../../electron/devHistory/services/time-wrangler' +import { IncrementAnalysis } from '../../electron/marketingWeek/models/IncrementAnalysis' +import { timeOfDayMatchesToSecond } from '../../electron/marketingWeek/services/time-wrangler' import { DescriptionAndHelp } from '../components/DescriptionAndHelp' +import { ScreenWrapper } from '../ReusableComponents/ScreenWrapper' + const faqs = [ { id: 1, @@ -51,12 +53,6 @@ export function MarketingWeekScreen() { IncrementAnalysis | undefined >(data?.analysis?.[0]) let control: ReactElement | undefined = undefined - const onRefreshClick = ( - e: React.MouseEvent, - ) => { - e.preventDefault() - logAMessage({ message: 'Refresh Clicked', level: 'info' }) - } const allBlogPosts = data?.analysis.reduce( (acc, cur) => { @@ -70,9 +66,15 @@ export function MarketingWeekScreen() { }, [] as { text: string }[], ) + const onOpenFolderClick = (event: React.MouseEvent) => { + event.preventDefault() + + logAMessage({ level: 'info', message: `Opening folder ${location}` }) + window.OpenDevHistoryCacheLocation.invoke() + } control = ( -
+
@@ -96,23 +98,22 @@ export function MarketingWeekScreen() {
{' '} - {allSocialPosts?.length || '-'} Potential Tweets/Posts + {allSocialPosts?.length || '-'} Draft Tweets/Posts
{' '} - {allBlogPosts?.length || '-'} Potential Blog Posts + {allBlogPosts?.length || '-'} Draft Blog Posts
{isLoading ? ( -
+
Please wait! This looks like a day that hasn't been - processed or there is new activity. We're crunching your - data and setting GPUs on fire. It could take{' '} + processed or there is new activity. It could take{' '} 3-4 minutes or more to - pass an entire day through AI!... + pass an entire day through AI! {' '}
+ {control} -
+ ) } diff --git a/src/app/MarketingWeek/ReactQueryWrappers.ts b/src/app/MarketingWeek/ReactQueryWrappers.ts index 8f79e2f..f6d6ae4 100644 --- a/src/app/MarketingWeek/ReactQueryWrappers.ts +++ b/src/app/MarketingWeek/ReactQueryWrappers.ts @@ -1,8 +1,8 @@ import { useQuery } from '@tanstack/react-query' import { useContext } from 'react' import { ConsoleContext } from '../ConsoleArea/ConsoleContext' -import { GitActivityForMonthResponse } from '../../electron/devHistory/channels/MessageTypes' -import { isToday } from 'date-fns' +import { GitActivityForMonthResponse } from '../../electron/marketingWeek/channels/MessageTypes' +import { format, isToday } from 'date-fns' export const wellKnownQueries = { getSingleDay: 'get-single-day', @@ -10,9 +10,17 @@ export const wellKnownQueries = { } export function useDevHistoryGetDay({ date }: { date: Date }) { const [_logMessages, logAMessage] = useContext(ConsoleContext) + return useQuery( [wellKnownQueries.getSingleDay, date.toISOString()], async () => { + logAMessage({ + message: `Started analyising ${format( + date, + 'yyyy-MM-dd', + )} Please wait for processing to finish! 🤖 We're crunching your data and setting GPUs on fire 🔥🔥. It could take 3-4 minutes or more to pass an entire day through AI! Honestly, get yourself a coffee ☕`, + level: 'info', + }) return window.GetDevHistorySingleDay.invoke({ date: date, }) diff --git a/src/app/Onboarding/OnboardingScreen.tsx b/src/app/Onboarding/OnboardingScreen.tsx index 8a74e52..f41ebb7 100644 --- a/src/app/Onboarding/OnboardingScreen.tsx +++ b/src/app/Onboarding/OnboardingScreen.tsx @@ -5,12 +5,13 @@ import { useSetFirstUsageDate } from '../AppSettings/ReactQueryWrappers' import PageHeader from '../components/PageHeader' import { ConsoleContext } from '../ConsoleArea/ConsoleContext' import OnboardingDialog from './OnboardingDialog' +import { ScreenWrapper } from '../ReusableComponents/ScreenWrapper' export function OnboardingScreen() { const navigation = useNavigate() const setFirstUsage = useSetFirstUsageDate() const [closed, setClosed] = useState(false) - const [logMessages, logAMessage] = useContext(ConsoleContext) + const [_logMessages, logAMessage] = useContext(ConsoleContext) useEffect(() => { if ( @@ -39,9 +40,9 @@ export function OnboardingScreen() { ]) return ( -
+ -
+ ) } diff --git a/src/app/Onboarding/hooks.ts b/src/app/Onboarding/hooks.ts index 96b10d8..4e4e8d7 100644 --- a/src/app/Onboarding/hooks.ts +++ b/src/app/Onboarding/hooks.ts @@ -19,7 +19,7 @@ export const useFirstRunRedirect = (): { const { data: licenceData, isLoading: licIsLd } = useGetLicensing() const navigateRoute = useNavigate() - const [logMessages, logAMessage] = useContext(ConsoleContext) + const [_logMessages, logAMessage] = useContext(ConsoleContext) // REDIRECT IF FIRST TIME USED! useEffect(() => { diff --git a/src/app/ReusableComponents/ScreenWrapper.tsx b/src/app/ReusableComponents/ScreenWrapper.tsx new file mode 100644 index 0000000..952e329 --- /dev/null +++ b/src/app/ReusableComponents/ScreenWrapper.tsx @@ -0,0 +1,9 @@ +import { PropsWithChildren } from 'react' + +export function ScreenWrapper({ children }: PropsWithChildren) { + return ( +
+ {children} +
+ ) +} diff --git a/src/app/SshUrlConverter/ReactQueryWrappers.ts b/src/app/SshUrlConverter/ReactQueryWrappers.ts index 4fca005..6d7b46e 100644 --- a/src/app/SshUrlConverter/ReactQueryWrappers.ts +++ b/src/app/SshUrlConverter/ReactQueryWrappers.ts @@ -10,7 +10,7 @@ export const wellKnownQueries = { convertSshUrl: 'convert-ssh-url', } export function useConvertSshUrl() { - const [logMessages, logAMessage] = useContext(ConsoleContext) + const [_logMessages, logAMessage] = useContext(ConsoleContext) return useMutation< SshUrlConverterChannelResponse, @@ -32,6 +32,6 @@ export function useConvertSshUrl() { level: 'info', }) }, - } + }, ) } diff --git a/src/app/SshUrlConverter/SshUrlConverterScreen.tsx b/src/app/SshUrlConverter/SshUrlConverterScreen.tsx index 920c02b..12e1502 100644 --- a/src/app/SshUrlConverter/SshUrlConverterScreen.tsx +++ b/src/app/SshUrlConverter/SshUrlConverterScreen.tsx @@ -12,6 +12,7 @@ import { SshConverterResults } from '../../electron/sshConfigFile/models/SshConv import { useGetSettings } from '../UserSettings/ReactQueryWrappers' import { DescriptionAndHelp } from '../components/DescriptionAndHelp' import { ConsoleContext } from '../ConsoleArea/ConsoleContext' +import { ScreenWrapper } from '../ReusableComponents/ScreenWrapper' const faqs = [ { @@ -46,14 +47,14 @@ export const SshUrlConverterScreen = () => { const [outputValue, setOutputValue] = useState< SshConverterResults | undefined >(undefined) - const [logMessages, logAMessage] = useContext(ConsoleContext) + const [_logMessages, logAMessage] = useContext(ConsoleContext) let control: ReactElement | undefined = undefined - const { isLoading, data, error } = useGetSettings() + const { isLoading, data } = useGetSettings() const onCopyClick = ( event: React.MouseEvent, - value: string + value: string, ) => { event.preventDefault() @@ -82,7 +83,7 @@ export const SshUrlConverterScreen = () => { setOutputValue(result.possibleGitUrls) } const handleInputKeyDown = async ( - event: React.KeyboardEvent + event: React.KeyboardEvent, ) => { if (event.key === 'Enter') { return runAction() @@ -90,7 +91,7 @@ export const SshUrlConverterScreen = () => { } const onOpenFolderClick = ( event: React.MouseEvent, - location: string + location: string, ) => { event.preventDefault() window.OpenFileLocation.invoke(location) @@ -99,7 +100,7 @@ export const SshUrlConverterScreen = () => { const insertSampleValue = (event: React.MouseEvent) => { event.preventDefault() setInputValue( - 'https://github.com/darraghoriordan/eslint-plugin-nestjs-typed.git' + 'https://github.com/darraghoriordan/eslint-plugin-nestjs-typed.git', ) } @@ -196,8 +197,8 @@ export const SshUrlConverterScreen = () => { ) } return ( -
- + + {data?.sshConfigFilePath && (
+ ) } diff --git a/src/app/StringCaseConverter/ReactQueryWrappers.ts b/src/app/StringCaseConverter/ReactQueryWrappers.ts index 83e4226..c3bddfe 100644 --- a/src/app/StringCaseConverter/ReactQueryWrappers.ts +++ b/src/app/StringCaseConverter/ReactQueryWrappers.ts @@ -11,7 +11,7 @@ export const wellKnownQueries = { stringCase: 'string-case', } export function useStringCaseConverter() { - const [logMessages, logAMessage] = useContext(ConsoleContext) + const [_logMessages, logAMessage] = useContext(ConsoleContext) return useMutation< StringCaseResponse, { message: string }, @@ -32,6 +32,6 @@ export function useStringCaseConverter() { level: 'info', }) }, - } + }, ) } diff --git a/src/app/StringCaseConverter/StringCaseConverterScreen.tsx b/src/app/StringCaseConverter/StringCaseConverterScreen.tsx index 348a4c8..69ed6fa 100644 --- a/src/app/StringCaseConverter/StringCaseConverterScreen.tsx +++ b/src/app/StringCaseConverter/StringCaseConverterScreen.tsx @@ -5,9 +5,10 @@ import { ArrowDownIcon, DocumentCheckIcon } from '@heroicons/react/24/outline' import { ConsoleContext } from '../ConsoleArea/ConsoleContext' import { StringCases } from '../../electron/stringCase/channels/MessageTypes' import { useStringCaseConverter } from './ReactQueryWrappers' +import { ScreenWrapper } from '../ReusableComponents/ScreenWrapper' export function StringCaseConverterScreen() { - const [logMessages, logAMessage] = useContext(ConsoleContext) + const [_logMessages, logAMessage] = useContext(ConsoleContext) const runMutation = useStringCaseConverter() const [inputValue, setInputValue] = useState('') const [caseMethod, setCaseMethod] = useState(StringCases.lower) @@ -36,7 +37,7 @@ export function StringCaseConverterScreen() { const insertSampleValue = (event: React.MouseEvent) => { event.preventDefault() setInputValue( - 'THIS IS A SAMPLE VALUE\r\nand_another_sample_value\r\none more sample value' + 'THIS IS A SAMPLE VALUE\r\nand_another_sample_value\r\none more sample value', ) } @@ -98,7 +99,7 @@ export function StringCaseConverterScreen() { ) } return ( -
+
+ ) } diff --git a/src/app/StringSorter/ReactQueryWrappers.ts b/src/app/StringSorter/ReactQueryWrappers.ts index 93c7c40..a2ea629 100644 --- a/src/app/StringSorter/ReactQueryWrappers.ts +++ b/src/app/StringSorter/ReactQueryWrappers.ts @@ -10,7 +10,7 @@ export const wellKnownQueries = { stringSort: 'string-sort', } export function useStringSort() { - const [logMessages, logAMessage] = useContext(ConsoleContext) + const [_logMessages, logAMessage] = useContext(ConsoleContext) return useMutation< StringSorterResponse, { message: string }, @@ -31,6 +31,6 @@ export function useStringSort() { level: 'info', }) }, - } + }, ) } diff --git a/src/app/StringSorter/StringSorterScreen.tsx b/src/app/StringSorter/StringSorterScreen.tsx index 67a9cf8..b33fdc8 100644 --- a/src/app/StringSorter/StringSorterScreen.tsx +++ b/src/app/StringSorter/StringSorterScreen.tsx @@ -7,6 +7,7 @@ import { useStringSort } from './ReactQueryWrappers' import { DescriptionAndHelp } from '../components/DescriptionAndHelp' import { useGetSystemLocale } from '../TimestampConverter/useGetCurrentLocale' import LocaleSelector from '../TimestampConverter/LocaleSelector' +import { ScreenWrapper } from '../ReusableComponents/ScreenWrapper' const faqs = [ { @@ -24,7 +25,7 @@ const faqs = [ ] export function StringSorterScreen() { - const [logMessages, logAMessage] = useContext(ConsoleContext) + const [_logMessages, logAMessage] = useContext(ConsoleContext) const runMutation = useStringSort() const [inputValue, setInputValue] = useState('') const [sortAsc, setSortAscValue] = useState(true) @@ -152,7 +153,7 @@ export function StringSorterScreen() { ) } return ( -
+
+ ) } diff --git a/src/app/TimestampConverter/ReactQueryWrappers.ts b/src/app/TimestampConverter/ReactQueryWrappers.ts index c68bd61..9a79693 100644 --- a/src/app/TimestampConverter/ReactQueryWrappers.ts +++ b/src/app/TimestampConverter/ReactQueryWrappers.ts @@ -10,7 +10,7 @@ export const wellKnownQueries = { convertTime: 'convert-time', } export function useTimestampConverter() { - const [logMessages, logAMessage] = useContext(ConsoleContext) + const [_logMessages, logAMessage] = useContext(ConsoleContext) return useMutation< UnixTimeConverterResponse, @@ -32,6 +32,6 @@ export function useTimestampConverter() { level: 'info', }) }, - } + }, ) } diff --git a/src/app/TimestampConverter/TimeStampConverterScreen.tsx b/src/app/TimestampConverter/TimeStampConverterScreen.tsx index 7ae7442..6427279 100644 --- a/src/app/TimestampConverter/TimeStampConverterScreen.tsx +++ b/src/app/TimestampConverter/TimeStampConverterScreen.tsx @@ -1,5 +1,5 @@ /* 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, DocumentCheckIcon } from '@heroicons/react/24/outline' import { useTimestampConverter } from './ReactQueryWrappers' @@ -7,9 +7,10 @@ import { UnixTimeConverterResponse } from '../../electron/unixTimeConverter/chan import { ConsoleContext } from '../ConsoleArea/ConsoleContext' import LocaleSelector from './LocaleSelector' import { useGetSystemLocale } from './useGetCurrentLocale' +import { ScreenWrapper } from '../ReusableComponents/ScreenWrapper' export function TimestampConverterScreen() { - const [logMessages, logAMessage] = useContext(ConsoleContext) + const [_logMessages, logAMessage] = useContext(ConsoleContext) const mutation = useTimestampConverter() const [inputValue, setInputValue] = useState('') const { data: systemLocale } = useGetSystemLocale() @@ -21,7 +22,7 @@ export function TimestampConverterScreen() { utcDate: '', } as UnixTimeConverterResponse) const handleInputKeyDown = async ( - event: React.KeyboardEvent + event: React.KeyboardEvent, ) => { if (event.key === 'Enter') { return runAction() @@ -60,7 +61,7 @@ export function TimestampConverterScreen() { } return ( -
+
-
+ ) } diff --git a/src/app/UrlEscaper/ReactQueryWrappers.ts b/src/app/UrlEscaper/ReactQueryWrappers.ts index df90a63..0b13202 100644 --- a/src/app/UrlEscaper/ReactQueryWrappers.ts +++ b/src/app/UrlEscaper/ReactQueryWrappers.ts @@ -10,7 +10,7 @@ export const wellKnownQueries = { urlEncode: 'url-encode', } export function useUrlEncoder() { - const [logMessages, logAMessage] = useContext(ConsoleContext) + const [_logMessages, logAMessage] = useContext(ConsoleContext) return useMutation< UrlEncoderResponse, { message: string }, @@ -31,6 +31,6 @@ export function useUrlEncoder() { level: 'info', }) }, - } + }, ) } diff --git a/src/app/UrlEscaper/UrlEncoderScreen.tsx b/src/app/UrlEscaper/UrlEncoderScreen.tsx index 021467a..f00086b 100644 --- a/src/app/UrlEscaper/UrlEncoderScreen.tsx +++ b/src/app/UrlEscaper/UrlEncoderScreen.tsx @@ -5,6 +5,7 @@ import { ArrowDownIcon, DocumentCheckIcon } from '@heroicons/react/24/outline' import { ConsoleContext } from '../ConsoleArea/ConsoleContext' import { useUrlEncoder } from './ReactQueryWrappers' import { DescriptionAndHelp } from '../components/DescriptionAndHelp' +import { ScreenWrapper } from '../ReusableComponents/ScreenWrapper' const faqs = [ { @@ -21,7 +22,7 @@ const faqs = [ ] export function UrlEncoderScreen() { - const [logMessages, logAMessage] = useContext(ConsoleContext) + const [_logMessages, logAMessage] = useContext(ConsoleContext) const runMutation = useUrlEncoder() const [inputValue, setInputValue] = useState('') const [encodeToggleValue, setEncodeToggleValue] = useState(true) @@ -130,7 +131,7 @@ export function UrlEncoderScreen() { defaultChecked={true} onChange={e => setEncodeComponentToggleValue( - e.currentTarget.id === 'forComponent' + e.currentTarget.id === 'forComponent', ) } type="radio" @@ -150,7 +151,7 @@ export function UrlEncoderScreen() { type="radio" onChange={e => setEncodeComponentToggleValue( - e.currentTarget.id === 'forComponent' + e.currentTarget.id === 'forComponent', ) } className="w-4 h-4 text-indigo-600 border-gray-300 focus:ring-indigo-500" @@ -194,7 +195,7 @@ export function UrlEncoderScreen() { ) } return ( -
+
+ ) } diff --git a/src/app/UserSettings/BooleanField.tsx b/src/app/UserSettings/BooleanField.tsx new file mode 100644 index 0000000..cc61bcd --- /dev/null +++ b/src/app/UserSettings/BooleanField.tsx @@ -0,0 +1,39 @@ +import { UseFormRegister } from 'react-hook-form' +import { UserSettings } from '../../electron/userSettings/models/UserSettings' + +/* eslint-disable @typescript-eslint/no-explicit-any */ +const BooleanField = ({ + settingKey, + register, + errors, + + labelText, +}: { + settingKey: keyof UserSettings + register: UseFormRegister + errors: Record + labelText: string + isRequired?: boolean +}) => { + return ( +
+ +
+ +
+ {errors[settingKey] && ( + This field is required + )} +
+ ) +} +export default BooleanField diff --git a/src/app/UserSettings/SettingPathSelectionField.tsx b/src/app/UserSettings/SettingPathSelectionField.tsx index ba5ff6d..24321e9 100644 --- a/src/app/UserSettings/SettingPathSelectionField.tsx +++ b/src/app/UserSettings/SettingPathSelectionField.tsx @@ -11,7 +11,6 @@ export function SettingPathSelectionField({ settingKey, // projectsPath register, errors, - data, labelText, // Git project path to scan for repositories isRequired, onSelect, @@ -20,7 +19,6 @@ export function SettingPathSelectionField({ settingKey: keyof UserSettings register: UseFormRegister errors: Record - data: Record labelText: string isRequired?: boolean onSelect: (event: React.MouseEvent) => Promise @@ -55,7 +53,6 @@ export function SettingPathSelectionField({ min: 1, })} className="block w-full pl-10 text-gray-900 border-0 rounded-none rounded-l-md py-1.5 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" - defaultValue={data[settingKey]} />
{errors[settingKey] && ( diff --git a/src/app/UserSettings/SettingsForm.tsx b/src/app/UserSettings/SettingsForm.tsx index 21a8334..19240b0 100644 --- a/src/app/UserSettings/SettingsForm.tsx +++ b/src/app/UserSettings/SettingsForm.tsx @@ -6,6 +6,7 @@ import { useContext } from 'react' import { ConsoleContext } from '../ConsoleArea/ConsoleContext' import { SettingPathSelectionField } from './SettingPathSelectionField' import { DocumentCheckIcon } from '@heroicons/react/24/outline' +import BooleanField from './BooleanField' const gitSections = [ { @@ -48,7 +49,7 @@ export function SettingsForm({ register, handleSubmit, formState: { errors }, - } = useForm() + } = useForm({ defaultValues: data }) return (
onSubmit(data))} > +
+
)} - - {/* */} - - {/* */} {control} -
+ ) } diff --git a/src/app/components/SidebarMenu.tsx b/src/app/components/SidebarMenu.tsx index cf0dbbc..7c2d478 100644 --- a/src/app/components/SidebarMenu.tsx +++ b/src/app/components/SidebarMenu.tsx @@ -33,7 +33,7 @@ const navigation = [ current: false, }, { - name: 'Eslint Rule Generator', + name: 'Eslint Rule AI Agent', href: '/eslint-rule-generator', icon: VariableIcon, current: false, diff --git a/src/electron/channelConfigurationsPubs.ts b/src/electron/channelConfigurationsPubs.ts index 53987bf..25b96d3 100644 --- a/src/electron/channelConfigurationsPubs.ts +++ b/src/electron/channelConfigurationsPubs.ts @@ -28,9 +28,10 @@ import { CurrentLocalePub } from './appSupport/CurrentLocalePub' import { SelectGitProjectsPathChannelPub } from './userSettings/channels/SelectGitProjectsPathChannelPub' import { SelectSshConfigFilePathChannelPub } from './userSettings/channels/SelectSshConfigFilePathChannelPub' import { SelectGitConfigFilePathChannelPub } from './userSettings/channels/SelectGitConfigFilePathChannelPub' -import { DevHistoryGetDayChannelPub } from './devHistory/channels/DevHistoryGetDayChannelPub' +import { DevHistoryGetDayChannelPub } from './marketingWeek/channels/DevHistoryGetDayChannelPub' import { SelectChromeHistoryFilePathChannelPub } from './userSettings/channels/SelectChromeHistoryFilePathChannelPub' -import { GitActivityForMonthChannelPub } from './devHistory/channels/GitActivityForMonthChannelPub' +import { GitActivityForMonthChannelPub } from './marketingWeek/channels/GitActivityForMonthChannelPub' +import { OpenDevHistoryCacheLocationPub } from './marketingWeek/channels/OpenDevHistoryCacheLocationPub' export const ChannelConfigurationPubs: ChannelConfigurationTypePub = { rtmSendChannels: [ @@ -38,6 +39,7 @@ export const ChannelConfigurationPubs: ChannelConfigurationTypePub = { new OpenFileLocationPub(), new OpenSubmitFeedbackPub(), new OpenStorePagePub(), + new OpenDevHistoryCacheLocationPub(), ], rtmInvokeChannels: [ // userSettings diff --git a/src/electron/channelConfigurationsSubs.ts b/src/electron/channelConfigurationsSubs.ts index 8fe0901..63b5b7f 100644 --- a/src/electron/channelConfigurationsSubs.ts +++ b/src/electron/channelConfigurationsSubs.ts @@ -28,9 +28,10 @@ import { CurrentLocaleSub } from './appSupport/CurrentLocaleSub' import { SelectGitProjectsPathChannelSub } from './userSettings/channels/SelectGitProjectsPathChannelSub' import { SelectSshConfigFilePathChannelSub } from './userSettings/channels/SelectSshConfigFilePathChannelSub' import { SelectGitConfigFilePathChannelSub } from './userSettings/channels/SelectGitConfigFilePathChannelSub' -import { DevHistoryGetDayChannelSub } from './devHistory/channels/DevHistoryGetDayChannelSub' +import { DevHistoryGetDayChannelSub } from './marketingWeek/channels/DevHistoryGetDayChannelSub' import { SelectChromeHistoryFilePathChannelSub } from './userSettings/channels/SelectChromeHistoryFilePathChannelSub' -import { GitActivityForMonthChannelSub } from './devHistory/channels/GitActivityForMonthChannelSub' +import { GitActivityForMonthChannelSub } from './marketingWeek/channels/GitActivityForMonthChannelSub' +import { OpenDevHistoryCacheLocationSub } from './marketingWeek/channels/OpenDevHistoryCacheLocationSub' export const ChannelConfigurationSubs: ChannelConfigurationTypeSub = { rtmSendChannels: [ @@ -38,6 +39,7 @@ export const ChannelConfigurationSubs: ChannelConfigurationTypeSub = { new OpenFileLocationSub(), new OpenSubmitFeedbackSub(), new OpenStorePageSub(), + new OpenDevHistoryCacheLocationSub(), ], rtmInvokeChannels: [ //userSettings diff --git a/src/electron/devHistory/channels/DevHistoryChannelEnum.ts b/src/electron/marketingWeek/channels/DevHistoryChannelEnum.ts similarity index 76% rename from src/electron/devHistory/channels/DevHistoryChannelEnum.ts rename to src/electron/marketingWeek/channels/DevHistoryChannelEnum.ts index 56a5191..c0a909b 100644 --- a/src/electron/devHistory/channels/DevHistoryChannelEnum.ts +++ b/src/electron/marketingWeek/channels/DevHistoryChannelEnum.ts @@ -2,4 +2,5 @@ export enum DevHistoryChannels { GET_DAY = 'GET_DAY', GET_GIT_ACTIVITY_FOR_MONTH = 'GET_GIT_ACTIVITY_FOR_MONTH', + OPEN_CACHE_LOCATION = 'OPEN_CACHE_LOCATION', } diff --git a/src/electron/devHistory/channels/DevHistoryGetDayChannelPub.ts b/src/electron/marketingWeek/channels/DevHistoryGetDayChannelPub.ts similarity index 100% rename from src/electron/devHistory/channels/DevHistoryGetDayChannelPub.ts rename to src/electron/marketingWeek/channels/DevHistoryGetDayChannelPub.ts diff --git a/src/electron/devHistory/channels/DevHistoryGetDayChannelSub.ts b/src/electron/marketingWeek/channels/DevHistoryGetDayChannelSub.ts similarity index 89% rename from src/electron/devHistory/channels/DevHistoryGetDayChannelSub.ts rename to src/electron/marketingWeek/channels/DevHistoryGetDayChannelSub.ts index 4e0d70f..4609560 100644 --- a/src/electron/devHistory/channels/DevHistoryGetDayChannelSub.ts +++ b/src/electron/marketingWeek/channels/DevHistoryGetDayChannelSub.ts @@ -1,9 +1,9 @@ import { IpcMainEvent } from 'electron' import { IIpcMainInvokeEventSub } from '../../IpcChannelTypes/IIpcMainInvokeEventSub' - import { DevHistoryGetDayChannelPub } from './DevHistoryGetDayChannelPub' import { DevHistoryDayResponse, DevHistoryGetDayRequest } from './MessageTypes' import { analyseDay } from '../services/day-analyser' +import { validateSettingsForTool } from './GitActivityForMonthChannelSub' export class DevHistoryGetDayChannelSub extends DevHistoryGetDayChannelPub @@ -18,6 +18,7 @@ export class DevHistoryGetDayChannelSub ): Promise { // read the list of entries from the chrome history sqlite database // return the list of entries + await validateSettingsForTool() const analysis = await analyseDay(request.date) return { diff --git a/src/electron/devHistory/channels/GitActivityForMonthChannelPub.ts b/src/electron/marketingWeek/channels/GitActivityForMonthChannelPub.ts similarity index 100% rename from src/electron/devHistory/channels/GitActivityForMonthChannelPub.ts rename to src/electron/marketingWeek/channels/GitActivityForMonthChannelPub.ts diff --git a/src/electron/devHistory/channels/GitActivityForMonthChannelSub.ts b/src/electron/marketingWeek/channels/GitActivityForMonthChannelSub.ts similarity index 56% rename from src/electron/devHistory/channels/GitActivityForMonthChannelSub.ts rename to src/electron/marketingWeek/channels/GitActivityForMonthChannelSub.ts index 5a0c92a..53bf209 100644 --- a/src/electron/devHistory/channels/GitActivityForMonthChannelSub.ts +++ b/src/electron/marketingWeek/channels/GitActivityForMonthChannelSub.ts @@ -6,6 +6,7 @@ import { GitActivityForMonthResponse, } from './MessageTypes' import { gitActivityForMonth } from '../services/month-analyser' +import { UserSettingsService } from '../../userSettings/services/UserSettingsService' export class GitActivityForMonthChannelSub extends GitActivityForMonthChannelPub @@ -23,6 +24,8 @@ export class GitActivityForMonthChannelSub ): Promise { // read the list of entries from the chrome history sqlite database // return the list of entries + + await validateSettingsForTool() const analysis = await gitActivityForMonth( request.startDate, request.endDate, @@ -33,3 +36,21 @@ export class GitActivityForMonthChannelSub } } } +export async function validateSettingsForTool() { + const userSettings = await UserSettingsService.getSettings() + if (!userSettings.hasEnabledMarketingWeek) { + throw new Error( + 'Marketing week is not enabled. You have to explicitly enable this feature in the App Settings because it shares your data with Open AI when this tool is opened.', + ) + } + if (!userSettings.openAiChatGptKey) { + throw new Error( + 'Marketing week is not enabled. You must configure an Open AI key in the App Settings.', + ) + } + if (!userSettings.chromeHistoryPath) { + throw new Error( + 'Marketing week is not enabled. You must configure the Chrome History file path in the App Settings.', + ) + } +} diff --git a/src/electron/devHistory/channels/MessageTypes.ts b/src/electron/marketingWeek/channels/MessageTypes.ts similarity index 100% rename from src/electron/devHistory/channels/MessageTypes.ts rename to src/electron/marketingWeek/channels/MessageTypes.ts diff --git a/src/electron/marketingWeek/channels/OpenDevHistoryCacheLocationPub.ts b/src/electron/marketingWeek/channels/OpenDevHistoryCacheLocationPub.ts new file mode 100644 index 0000000..cfc9523 --- /dev/null +++ b/src/electron/marketingWeek/channels/OpenDevHistoryCacheLocationPub.ts @@ -0,0 +1,8 @@ +import { SendChannelBasePub } from '../../IpcChannelTypes/SendChannelBasePub' +import { DevHistoryChannels } from './DevHistoryChannelEnum' + +export class OpenDevHistoryCacheLocationPub extends SendChannelBasePub { + constructor() { + super('OpenDevHistoryCacheLocation', DevHistoryChannels.OPEN_CACHE_LOCATION) + } +} diff --git a/src/electron/marketingWeek/channels/OpenDevHistoryCacheLocationSub.ts b/src/electron/marketingWeek/channels/OpenDevHistoryCacheLocationSub.ts new file mode 100644 index 0000000..3a95184 --- /dev/null +++ b/src/electron/marketingWeek/channels/OpenDevHistoryCacheLocationSub.ts @@ -0,0 +1,16 @@ +import { IpcMainEvent, shell } from 'electron' +import { OpenDevHistoryCacheLocationPub } from './OpenDevHistoryCacheLocationPub' +import { IIpcMainSendEventSub } from '../../IpcChannelTypes/IIpcMainSendEventSub' +import { getBaseCachePath } from '../services/dev-history-cache' + +export class OpenDevHistoryCacheLocationSub + extends OpenDevHistoryCacheLocationPub + implements IIpcMainSendEventSub +{ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + handle(_event: IpcMainEvent): void { + const path = getBaseCachePath() + console.log('OpenDevHistoryCacheLocation.handle', path) + shell.showItemInFolder(path) + } +} diff --git a/src/electron/devHistory/models/HistoryEntry.ts b/src/electron/marketingWeek/models/HistoryEntry.ts similarity index 100% rename from src/electron/devHistory/models/HistoryEntry.ts rename to src/electron/marketingWeek/models/HistoryEntry.ts diff --git a/src/electron/devHistory/models/IncrementAnalysis.ts b/src/electron/marketingWeek/models/IncrementAnalysis.ts similarity index 100% rename from src/electron/devHistory/models/IncrementAnalysis.ts rename to src/electron/marketingWeek/models/IncrementAnalysis.ts diff --git a/src/electron/devHistory/services/chrome-browser-history.ts b/src/electron/marketingWeek/services/chrome-browser-history.ts similarity index 100% rename from src/electron/devHistory/services/chrome-browser-history.ts rename to src/electron/marketingWeek/services/chrome-browser-history.ts diff --git a/src/electron/devHistory/services/day-analyser.ts b/src/electron/marketingWeek/services/day-analyser.ts similarity index 99% rename from src/electron/devHistory/services/day-analyser.ts rename to src/electron/marketingWeek/services/day-analyser.ts index e3c225f..f92d13b 100644 --- a/src/electron/devHistory/services/day-analyser.ts +++ b/src/electron/marketingWeek/services/day-analyser.ts @@ -15,6 +15,7 @@ import { getFromCache, saveToCache } from './dev-history-cache' export async function analyseDay(date: Date) { // make sure we have the openAi key + const settings = await UserSettingsService.getSettings() if (!settings.openAiChatGptKey) { throw new Error('no openApiChatGptKey') diff --git a/src/electron/devHistory/services/dev-history-cache.ts b/src/electron/marketingWeek/services/dev-history-cache.ts similarity index 76% rename from src/electron/devHistory/services/dev-history-cache.ts rename to src/electron/marketingWeek/services/dev-history-cache.ts index b3d0357..06ee281 100644 --- a/src/electron/devHistory/services/dev-history-cache.ts +++ b/src/electron/marketingWeek/services/dev-history-cache.ts @@ -26,20 +26,28 @@ export async function saveToCache( const cachePath = await getCachePath(startDate) console.log('saving to cache', cachePath) if (!fs.existsSync(path.dirname(cachePath))) { + console.log('creating cache directory recursively') await fsp.mkdir(path.dirname(cachePath), { recursive: true }) } const now = new Date() // only save items that are not in the future analysis = analysis.filter(a => a.increment.endDate <= now) - console.log(`saving filtered ${analysis.length} to cache`) + console.time('saving data to cache') + console.log( + `saving filtered (no future items) list ${analysis.length} to cache`, + ) await fsp.writeFile(cachePath, JSON.stringify(analysis)) + console.timeEnd('saving data to cache') } +export function getBaseCachePath(): string { + const cachePath = path.join(app.getPath('userData'), 'dev-history-cache') + return cachePath +} async function getCachePath(startDate: Date): Promise { const cachePath = path.join( - app.getPath('userData'), - 'dev-history-cache', + getBaseCachePath(), `${startDate.toISOString()}.json`, ) return cachePath diff --git a/src/electron/devHistory/services/git-repository-history.test.ts b/src/electron/marketingWeek/services/git-repository-history.test.ts similarity index 100% rename from src/electron/devHistory/services/git-repository-history.test.ts rename to src/electron/marketingWeek/services/git-repository-history.test.ts diff --git a/src/electron/devHistory/services/git-repository-history.ts b/src/electron/marketingWeek/services/git-repository-history.ts similarity index 100% rename from src/electron/devHistory/services/git-repository-history.ts rename to src/electron/marketingWeek/services/git-repository-history.ts diff --git a/src/electron/devHistory/services/month-analyser-cache.ts b/src/electron/marketingWeek/services/month-analyser-cache.ts similarity index 100% rename from src/electron/devHistory/services/month-analyser-cache.ts rename to src/electron/marketingWeek/services/month-analyser-cache.ts diff --git a/src/electron/devHistory/services/month-analyser.ts b/src/electron/marketingWeek/services/month-analyser.ts similarity index 100% rename from src/electron/devHistory/services/month-analyser.ts rename to src/electron/marketingWeek/services/month-analyser.ts diff --git a/src/electron/devHistory/services/notEmpty.ts b/src/electron/marketingWeek/services/notEmpty.ts similarity index 100% rename from src/electron/devHistory/services/notEmpty.ts rename to src/electron/marketingWeek/services/notEmpty.ts diff --git a/src/electron/devHistory/services/openai-service.ts b/src/electron/marketingWeek/services/openai-service.ts similarity index 98% rename from src/electron/devHistory/services/openai-service.ts rename to src/electron/marketingWeek/services/openai-service.ts index 48b5d0a..6e53d67 100644 --- a/src/electron/devHistory/services/openai-service.ts +++ b/src/electron/marketingWeek/services/openai-service.ts @@ -193,6 +193,7 @@ async function runCodeDiffCompletion( - don't explain your answer - don't mention the date or time period events occurred in your summary e.g. don't say "In september I...." - don't prepend with "stand up report:" or a descriptor like that. just return the report. + - don't prepend with "the team member..." or similar, just return the report. - be terse - make sure to talk about any git code diffs if they are provided, but don't mention this if there are no diffs provided to you`, }, @@ -233,6 +234,8 @@ export async function runCodeSocialMediaPostsCompletion( role: 'system', content: `You are an expert software engineer and social media marketer. You have been asked to generate social media posts (tweets and blog posts) for a business. The audience is technical. + do not use hashtags + examples of good topics for tweets and blog posts: Industry Trends: Share your insights on the latest trends in your industry. @@ -307,7 +310,7 @@ Perform the following steps 2. identify tricky sections or interesting sections. If none just write about the overall change. 3. write tweets about the code -examples of interesting sections: +examples of interesting code things: - the libraries, tools and frameworks used and how they helped - the benefit of overall change - the number of lines added or removed if significant @@ -324,6 +327,7 @@ guidelines: - do not explain your answer - you don't have to add properties for hashtags, just include them in the text - you don't have to suggest an image for the social media posts, just the text + - you shouldn't use hashtags, don't add any hashtags - output JSON only. Output an array of JSON objects with property "text" e.g. [ {"text": "abc..."}, {"text": "abc..."}, @@ -542,6 +546,7 @@ export async function runBrowsingSocialMediaPostsCompletion( - do not explain your answer - you don't have to add properties for hashtags, just include them in the text - you don't have to suggest an image for the social media posts, just the text + - you shouldn't use hashtags, don't add any hashtags - output JSON only. Output an array of JSON objects with property "text" e.g. [ {"text": "abc..."}, {"text": "abc..."}, diff --git a/src/electron/devHistory/services/time-wrangler.test.ts b/src/electron/marketingWeek/services/time-wrangler.test.ts similarity index 100% rename from src/electron/devHistory/services/time-wrangler.test.ts rename to src/electron/marketingWeek/services/time-wrangler.test.ts diff --git a/src/electron/devHistory/services/time-wrangler.ts b/src/electron/marketingWeek/services/time-wrangler.ts similarity index 100% rename from src/electron/devHistory/services/time-wrangler.ts rename to src/electron/marketingWeek/services/time-wrangler.ts diff --git a/webpack.rules.js b/webpack.rules.js index 30ab667..6ddc7b6 100644 --- a/webpack.rules.js +++ b/webpack.rules.js @@ -17,7 +17,7 @@ module.exports = [ }, }, { - test: /\.(png|jpe?g|gif)$/i, + test: /\.(png|jpe?g|gif|svg)$/i, use: { loader: 'file-loader', options: {