diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5ec07f9..7d7c229 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,12 +13,17 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup .NET - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v4 with: - dotnet-version: 6.0.x + dotnet-version: 8 + + - name: Setup NodeJS + uses: actions/setup-node@v4 + with: + node-version: '20.x' - name: Restore dependencies run: | @@ -27,7 +32,7 @@ jobs: - name: Build run: | - npm run build -- --mode=production + npm run build -- -- --mode=production dotnet build --configuration Release --no-restore - name: Test @@ -45,16 +50,11 @@ jobs: rm appsettings.Development.json zip -r ../HintKeep.zip . - - name: Azure Authentication - if: github.event_name == 'push' && contains(toJSON(github.event.commits.*.message), '[release]') - uses: azure/login@v1 + - uses: Azure/webapps-deploy@v3.0.1 with: - creds: ${{ secrets.AZURE_CREDENTIALS }} - - - name: Deploy Application - if: github.event_name == 'push' && contains(toJSON(github.event.commits.*.message), '[release]') - shell: pwsh - run: | - az webapp stop --resource-group HintKeep --name HintKeep - az webapp deployment source config-zip --resource-group HintKeep --name HintKeep --src ./Publish/HintKeep.zip - az webapp start --resource-group HintKeep --name HintKeep \ No newline at end of file + app-name: '' + publish-profile: ${{ secrets.PUBLISH_PROFILE }} + package: ./Publish/HintKeep.zip + type: zip + clean: true + restart: true diff --git a/HintKeep.Tests/HintKeep.Tests.csproj b/HintKeep.Tests/HintKeep.Tests.csproj index 35370e8..fb82abc 100644 --- a/HintKeep.Tests/HintKeep.Tests.csproj +++ b/HintKeep.Tests/HintKeep.Tests.csproj @@ -1,18 +1,18 @@ - net6.0 + net8.0 false - - - - - + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/HintKeep/Client/components/alerts/alert.tsx b/HintKeep/Client/components/alerts/alert.tsx index 158f030..f83bea4 100644 --- a/HintKeep/Client/components/alerts/alert.tsx +++ b/HintKeep/Client/components/alerts/alert.tsx @@ -1,22 +1,21 @@ import type { AlertViewModel } from '../../view-models/alerts-view-model'; -import React from 'react'; import classnames from 'classnames'; -import { watchViewModel } from 'react-model-view-viewmodel'; import { Message } from '../i18n'; +import { useViewModel } from 'react-model-view-viewmodel'; import Style from './../style.scss'; export interface IAlertProps { - readonly $vm: AlertViewModel; + readonly alertViewModel: AlertViewModel; }; -export function Alert({ $vm }: IAlertProps): JSX.Element { - watchViewModel($vm); +export function Alert({ alertViewModel }: IAlertProps): JSX.Element { + useViewModel(alertViewModel); return (
- -
); } \ No newline at end of file diff --git a/HintKeep/Client/components/alerts/alerts.tsx b/HintKeep/Client/components/alerts/alerts.tsx index 02cddbb..eec7964 100644 --- a/HintKeep/Client/components/alerts/alerts.tsx +++ b/HintKeep/Client/components/alerts/alerts.tsx @@ -1,15 +1,14 @@ -import React from 'react'; import { Alert } from './alert'; -import { requireViewModel } from '../use-view-model'; -import { watchCollection } from 'react-model-view-viewmodel'; +import { useObservableCollection, useViewModelDependency } from 'react-model-view-viewmodel'; +import { AlertsViewModel } from '../../view-models/alerts-view-model'; export function Alerts(): JSX.Element { - const $vm = requireViewModel(({ alertsViewModel }) => alertsViewModel); - watchCollection($vm.alerts); + const alertsViewModel = useViewModelDependency(AlertsViewModel); + useObservableCollection(alertsViewModel.alerts); return ( <> - {$vm.alerts.map((alert, index) => )} + {alertsViewModel.alerts.map((alert, index) => )} ); } \ No newline at end of file diff --git a/HintKeep/Client/components/app.tsx b/HintKeep/Client/components/app.tsx index 4523a18..dafc99c 100644 --- a/HintKeep/Client/components/app.tsx +++ b/HintKeep/Client/components/app.tsx @@ -1,16 +1,16 @@ import type { PropsWithChildren } from 'react'; -import React from 'react'; import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom'; import classnames from 'classnames'; import { Message } from './i18n'; import { Alerts } from './alerts'; -import { useViewModel } from './use-view-model'; import { Login, Register, Confirmation, Recovery, PasswordReset, Extra, Accounts, AddAccount, EditAccount, AccountHints, DeletedAccountDetails, DeletedAccounts, TermsOfService } from './pages'; +import { useViewModelDependency } from 'react-model-view-viewmodel'; +import { SessionViewModel } from '../view-models/session-view-model'; import Style from './style.scss'; export function App(): JSX.Element { - const $vm = useViewModel(({ sessionViewModel }) => sessionViewModel); + const sessionViewModel = useViewModelDependency(SessionViewModel); return (
@@ -20,7 +20,7 @@ export function App(): JSX.Element { - {$vm.isSessionActive + {sessionViewModel.isSessionActive ? <> } /> diff --git a/HintKeep/Client/components/conditionals/else.tsx b/HintKeep/Client/components/conditionals/else.tsx index 0ee08e9..3aaadbb 100644 --- a/HintKeep/Client/components/conditionals/else.tsx +++ b/HintKeep/Client/components/conditionals/else.tsx @@ -1,5 +1,4 @@ import type { PropsWithChildren } from "react"; -import React from "react"; export function Else({ children }: PropsWithChildren<{}>): JSX.Element { return <>{children}; diff --git a/HintKeep/Client/components/conditionals/then.tsx b/HintKeep/Client/components/conditionals/then.tsx index d898cc4..8ce3f82 100644 --- a/HintKeep/Client/components/conditionals/then.tsx +++ b/HintKeep/Client/components/conditionals/then.tsx @@ -1,5 +1,4 @@ import type { PropsWithChildren } from "react"; -import React from "react"; export function Then({ children }: PropsWithChildren<{}>): JSX.Element { return <>{children}; diff --git a/HintKeep/Client/components/forms/checkbox-form-input.tsx b/HintKeep/Client/components/forms/checkbox-form-input.tsx index f1a1ab3..c87cf6a 100644 --- a/HintKeep/Client/components/forms/checkbox-form-input.tsx +++ b/HintKeep/Client/components/forms/checkbox-form-input.tsx @@ -1,12 +1,11 @@ import type { PropsWithChildren } from 'react'; import type { IInputProps } from './input'; -import React from 'react'; import classnames from 'classnames'; -import { watchViewModel } from 'react-model-view-viewmodel'; import { Input } from './input'; import { Message } from '../i18n'; import Style from '../style.scss'; +import { useViewModel } from 'react-model-view-viewmodel'; export interface IFormCheckboxInputProps extends IInputProps { readonly label: string; @@ -15,7 +14,7 @@ export interface IFormCheckboxInputProps extends IInputProps { } export function FormCheckboxInput({ label, description, field, id, className, type, children, ...inputProps }: PropsWithChildren): JSX.Element { - watchViewModel(field, ['value', 'error']); + useViewModel(field); return (
@@ -24,7 +23,7 @@ export function FormCheckboxInput({ label, description, field, id, className, ty {children} -
{field.error !== undefined && }
+
{field.error !== null && }
{description &&
}
); diff --git a/HintKeep/Client/components/forms/form-input.tsx b/HintKeep/Client/components/forms/form-input.tsx index b116017..420f165 100644 --- a/HintKeep/Client/components/forms/form-input.tsx +++ b/HintKeep/Client/components/forms/form-input.tsx @@ -1,6 +1,5 @@ import type { IInputProps } from './input'; -import React from 'react'; -import { watchViewModel } from 'react-model-view-viewmodel'; +import { useViewModel } from 'react-model-view-viewmodel'; import { Input } from './input'; import { Message } from '../i18n'; @@ -13,13 +12,13 @@ export interface IFormInputProps extends IInputProps { } export function FormInput({ label, description, field, id, className, ...inputProps }: IFormInputProps): JSX.Element { - watchViewModel(field, ['error']); + useViewModel(field); return (
-
{field.error !== undefined && }
+
{field.error !== null && }
{description &&
}
); diff --git a/HintKeep/Client/components/forms/form-text-area.tsx b/HintKeep/Client/components/forms/form-text-area.tsx index 2827712..ad4b61d 100644 --- a/HintKeep/Client/components/forms/form-text-area.tsx +++ b/HintKeep/Client/components/forms/form-text-area.tsx @@ -1,6 +1,5 @@ import type { ITextAreaProps } from './text-area'; -import React from 'react'; -import { watchViewModel } from 'react-model-view-viewmodel'; +import { useViewModel } from 'react-model-view-viewmodel'; import { TextArea } from './text-area'; import { Message } from '../i18n'; @@ -13,13 +12,13 @@ export interface IFormInputProps extends ITextAreaProps { } export function FormTextArea({ label, description, field, id, className, ...textAreaProps }: IFormInputProps): JSX.Element { - watchViewModel(field, ['isTouched', 'error']); + useViewModel(field); return (