Skip to content

Commit

Permalink
autocompletion turn off (#16)
Browse files Browse the repository at this point in the history
* add webvisor

* remove ya metrica in dev env

* disable calc button if there is only one person

* remove unused code

* add tests

* #6 fix backend error

* fix #6

* #10 add healthcheck

* add production config, please close #10

* fix healtcheck

* add serilog and sentry, #9, #8; webvison 2;

* update release version for Sentry

* update manifest.json for mobile version

* close #9; close #8;

* add keywords for yandex search

* Bug/case (#14)

* catch corner case

* ignore IDE files for Client app

* Add tests for #12. Close #12

* remove unused code

* remove unused file. Close #12

* Remove autocomplete, change Input to TextField

* Update release version
  • Loading branch information
framebassman committed Apr 16, 2019
1 parent 93b9d29 commit 44ba329
Show file tree
Hide file tree
Showing 8 changed files with 140 additions and 82 deletions.
3 changes: 3 additions & 0 deletions Izzy.Web/Client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# IDE files
.idea/*
18 changes: 3 additions & 15 deletions Izzy.Web/Client/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,9 @@
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="theme-color" content="#000000" />
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<meta name="theme-color" content="#8fd5eb" />
<meta name="description" content="Приложение калькулятор, кто кому сколько должен. Теперь разделить совместные затраты легко."/>
<link rel="manifest" href="manifest.json" />
<title>Izzy - калькулятор для вечеринок</title>
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion Izzy.Web/Client/src/__tests__/Calculator.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { Provider } from 'react-redux';
import { shallow, mount, ReactWrapper } from 'enzyme';
import { mount, ReactWrapper } from 'enzyme';
import moxios from 'moxios';

import configureStore from '../store/configureStore';
Expand Down
56 changes: 56 additions & 0 deletions Izzy.Web/Client/src/__tests__/Outcomes.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import * as React from 'react';
import { mount, ReactWrapper } from 'enzyme';
import { Outcomes } from '../components/outcomes/Outcomes';

describe('<Outcomes />', () => {
let component: ReactWrapper;

afterEach(() => {
component.unmount();
});

it('"Я" should be transform to "Мне"', done => {
// Arrange
const transfers: any[] = [
{ from: 'Алиса', to: 'Я', roubles: 1 }
];

// Act
component = mount(<Outcomes transfers={transfers}/>);

// Assert
const toCell = component.find('#to1').hostNodes();
expect(toCell.text()).toEqual('Мне');
done();
});

it('"я" should be transform to "яне"', done => {
// Arrange
const transfers: any[] = [
{ from: 'Алиса', to: 'я', roubles: 1 }
];

// Act
component = mount(<Outcomes transfers={transfers}/>);

// Assert
const toCell = component.find('#to1').hostNodes();
expect(toCell.text()).toEqual('мне');
done();
});

it('"Боб" should be transform to "Бобу"', done => {
// Arrange
const transfers: any[] = [
{ from: 'Алиса', to: 'Боб', roubles: 1 }
];

// Act
component = mount(<Outcomes transfers={transfers}/>);

// Assert
const toCell = component.find('#to1').hostNodes();
expect(toCell.text()).toEqual('Бобу');
done();
});
});
7 changes: 5 additions & 2 deletions Izzy.Web/Client/src/components/incomes/Incomes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ export class Incomes extends Component<any, any> {
<Field
name={`persons.${index}.name`}
render={({field, form}: FieldProps<any>) => (
<Input
<TextField
name={`persons.${index}.name`}
className="person__input"
placeholder={person.name}
autoComplete="off"
onChange={(event) => {
field.onChange(event)
form.setFieldValue(`persons.${index}.name`, event.target.value)
Expand All @@ -51,10 +52,12 @@ export class Incomes extends Component<any, any> {
<Field
name={`persons.${index}.roubles`}
render={({field, form}: FieldProps<any>) => (
<Input
<TextField
name={`persons.${index}.roubles`}
className="person__input"
placeholder={person.roubles.toString()}
autoComplete="off"
type="number"
onChange={(event) => {
field.onChange(event)
form.setFieldValue(`persons.${index}.roubles`, event.target.value)
Expand Down
30 changes: 20 additions & 10 deletions Izzy.Web/Client/src/components/outcomes/Transfers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,35 @@ import TableCell from '@material-ui/core/TableCell';
import TableRow from '@material-ui/core/TableRow';
const petrovich = require('petrovich');

export class Transfers extends Component<any, any> {
destInPropriateCase(dest: string): string {
const first = dest.trim().split(' ')[0];
const person = { gender: 'male', first };
const result = petrovich(person, 'dative').first;
const withoutFirst = dest.replace(first, '');
return result + withoutFirst;
function destInPropriateCase(dest: string): string {
const first = dest.trim().split(' ')[0];
const result = conjugateToDativeCase(first);
const withoutFirst = dest.replace(first, '');
return result + withoutFirst;
}

function conjugateToDativeCase(origin: string): string {
if (origin === 'Я') {
return 'Мне';
}
if (origin === 'я') {
return 'мне';
}
const person = { gender: 'male', first: origin };
return petrovich(person, 'dative').first;
}

export class Transfers extends Component<any, any> {
render() {
const { src } = this.props;
let inputs = [];
let i = 0;
for (const tr of src) {
inputs.push(
<TableRow key={i++}>
<TableCell>{tr.from}</TableCell>
<TableCell>{this.destInPropriateCase(tr.to)}</TableCell>
<TableCell>{tr.roubles}</TableCell>
<TableCell id={`from${i}`}>{tr.from}</TableCell>
<TableCell id={`to${i}`}>{destInPropriateCase(tr.to)}</TableCell>
<TableCell id={`roubles${i}`}>{tr.roubles}</TableCell>
</TableRow>
)
}
Expand Down
104 changes: 52 additions & 52 deletions Izzy.Web/Program.cs
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
using System;
using System.IO;
using System.Net;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Sentry;
using Serilog;
using Serilog.Events;
using Serilog.Formatting.Compact;

namespace Izzy.Web
{
public class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}

private static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.UseUrls("http://0.0.0.0:5000")
.UseSerilog((h, c) =>
c.Enrich.FromLogContext()
.MinimumLevel.Warning()
.MinimumLevel.Override("Izzy.Web", LogEventLevel.Information)
.WriteTo.ColoredConsole()
.WriteTo.Sentry(s =>
{
s.MinimumBreadcrumbLevel = LogEventLevel.Debug;
s.MinimumEventLevel = LogEventLevel.Error;
})
)
.UseSentry(options =>
{
options.Release = "1.0.5";
options.Environment = CurrentEnv();
options.MaxQueueItems = 100;
options.ShutdownTimeout = TimeSpan.FromSeconds(5);
options.DecompressionMethods = DecompressionMethods.None;
})
;

private static String CurrentEnv()
{
return Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Production";
}
}
}
using System;
using System.IO;
using System.Net;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Sentry;
using Serilog;
using Serilog.Events;
using Serilog.Formatting.Compact;

namespace Izzy.Web
{
public class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}

private static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.UseUrls("http://0.0.0.0:5000")
.UseSerilog((h, c) =>
c.Enrich.FromLogContext()
.MinimumLevel.Warning()
.MinimumLevel.Override("Izzy.Web", LogEventLevel.Information)
.WriteTo.ColoredConsole()
.WriteTo.Sentry(s =>
{
s.MinimumBreadcrumbLevel = LogEventLevel.Debug;
s.MinimumEventLevel = LogEventLevel.Error;
})
)
.UseSentry(options =>
{
options.Release = "1.0.6";
options.Environment = CurrentEnv();
options.MaxQueueItems = 100;
options.ShutdownTimeout = TimeSpan.FromSeconds(5);
options.DecompressionMethods = DecompressionMethods.None;
})
;

private static String CurrentEnv()
{
return Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Production";
}
}
}
2 changes: 0 additions & 2 deletions base_path_solution.txt

This file was deleted.

0 comments on commit 44ba329

Please sign in to comment.