Skip to content

Commit

Permalink
chore: fix current imports
Browse files Browse the repository at this point in the history
  • Loading branch information
mariaozamiz committed May 16, 2024
1 parent e2b099a commit bb3ecb5
Show file tree
Hide file tree
Showing 25 changed files with 49 additions and 49 deletions.
4 changes: 2 additions & 2 deletions src/data/api-futures.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Future } from "../domain/entities/generic/Future";
import { CancelableResponse } from "../types/d2-api";
import { Future } from "$/domain/entities/generic/Future";
import { CancelableResponse } from "$/types/d2-api";

export type FutureData<D> = Future<Error, D>;

Expand Down
8 changes: 4 additions & 4 deletions src/data/repositories/UserD2Repository.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { User } from "../../domain/entities/User";
import { UserRepository } from "../../domain/repositories/UserRepository";
import { D2Api, MetadataPick } from "../../types/d2-api";
import { apiToFuture, FutureData } from "../api-futures";
import { User } from "$/domain/entities/User";
import { UserRepository } from "$/domain/repositories/UserRepository";
import { D2Api, MetadataPick } from "$/types/d2-api";
import { apiToFuture, FutureData } from "$/data/api-futures";

export class UserD2Repository implements UserRepository {
constructor(private api: D2Api) {}
Expand Down
10 changes: 5 additions & 5 deletions src/data/repositories/UserTestRepository.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { User } from "../../domain/entities/User";
import { createAdminUser } from "../../domain/entities/__tests__/userFixtures";
import { Future } from "../../domain/entities/generic/Future";
import { UserRepository } from "../../domain/repositories/UserRepository";
import { FutureData } from "../api-futures";
import { User } from "$/domain/entities/User";
import { createAdminUser } from "$/domain/entities/__tests__/userFixtures";
import { Future } from "$/domain/entities/generic/Future";
import { UserRepository } from "$/domain/repositories/UserRepository";
import { FutureData } from "$/data/api-futures";

export class UserTestRepository implements UserRepository {
public getCurrent(): FutureData<User> {
Expand Down
4 changes: 2 additions & 2 deletions src/domain/entities/__tests__/userFixtures.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { User, UserRole } from "../User";
import { NamedRef } from "../Ref";
import { User, UserRole } from "$/domain/entities/User";
import { NamedRef } from "$/domain/entities/Ref";

export function createAdminUser(): User {
const adminRoles = [{ id: "Hg7n0MwzUQn", name: "Super user", authorities: ["ALL"] }];
Expand Down
2 changes: 1 addition & 1 deletion src/domain/entities/generic/__tests/Collection.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, test } from "vitest";
import _, { Collection } from "../Collection";
import _, { Collection } from "$/domain/entities/generic/Collection";
import { expectTypeOf } from "expect-type";

describe("Collection", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/domain/entities/generic/__tests/Future.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, test, it, vi, expectTypeOf } from "vitest";
import { Future } from "../Future";
import { Future } from "$/domain/entities/generic/Future";

describe("Basic builders", () => {
test("Future.success", async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/domain/entities/generic/__tests/HashMap.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, test } from "vitest";
import { HashMap } from "../HashMap";
import { HashMap } from "$/domain/entities/generic/HashMap";

const mapAbc123 = HashMap.fromPairs([
["a", 1],
Expand Down
2 changes: 1 addition & 1 deletion src/domain/entities/generic/__tests/Rec.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Rec } from "../Rec";
import { Rec } from "$/domain/entities/generic/Rec";
import { expectTypeOf } from "expect-type";

const rec1 = Rec.from({ x: 1, s: "hello", n: null });
Expand Down
2 changes: 1 addition & 1 deletion src/domain/entities/generic/__tests/Struct.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, test } from "vitest";
import { Struct } from "../Struct";
import { Struct } from "$/domain/entities/generic/Struct";

class Person extends Struct<{ name: string; age: number }>() {
description() {
Expand Down
4 changes: 2 additions & 2 deletions src/domain/repositories/UserRepository.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FutureData } from "../../data/api-futures";
import { User } from "../entities/User";
import { FutureData } from "$/data/api-futures";
import { User } from "$/domain/entities/User";

export interface UserRepository {
getCurrent(): FutureData<User>;
Expand Down
6 changes: 3 additions & 3 deletions src/domain/usecases/GetCurrentUserUseCase.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FutureData } from "../../data/api-futures";
import { User } from "../entities/User";
import { UserRepository } from "../repositories/UserRepository";
import { FutureData } from "$/data/api-futures";
import { User } from "$/domain/entities/User";
import { UserRepository } from "$/domain/repositories/UserRepository";

export class GetCurrentUserUseCase {
constructor(private usersRepository: UserRepository) {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getTestCompositionRoot } from "../../../CompositionRoot";
import { getTestCompositionRoot } from "$/CompositionRoot";

describe("GetCurrentUserUseCase", () => {
it("returns user", async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/example.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { command, run, string, option } from "cmd-ts";
import path from "path";
import { D2Api } from "../types/d2-api";
import { D2Api } from "$/types/d2-api";

function main() {
const cmd = command({
Expand Down
2 changes: 1 addition & 1 deletion src/utils/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @ts-ignore
import i18n from "../locales";
import i18n from "$/locales";

function t<Str extends string>(s: Str, namespace?: GetNamespace<Str>): string {
return i18n.t(s, namespace);
Expand Down
6 changes: 3 additions & 3 deletions src/utils/tests.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { render, RenderResult } from "@testing-library/react";
import { SnackbarProvider } from "@eyeseetea/d2-ui-components";
import { ReactNode } from "react";
import { AppContext, AppContextState } from "../webapp/contexts/app-context";
import { getTestCompositionRoot } from "../CompositionRoot";
import { createAdminUser } from "../domain/entities/__tests__/userFixtures";
import { AppContext, AppContextState } from "$/webapp/contexts/app-context";
import { getTestCompositionRoot } from "$/CompositionRoot";
import { createAdminUser } from "$/domain/entities/__tests__/userFixtures";

export function getTestContext() {
const context: AppContextState = {
Expand Down
2 changes: 1 addition & 1 deletion src/webapp/components/card-grid/CardGrid.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import styled from "styled-components";
import { PageHeader } from "../page-header/PageHeader";
import { PageHeader } from "$/webapp/components/page-header/PageHeader";
import { MenuCard, MenuCardProps } from "./MenuCard";

export const CardGrid: React.FC<CardGridProps> = React.memo(({ title, cards, onBackClick }) => {
Expand Down
2 changes: 1 addition & 1 deletion src/webapp/components/card-grid/MenuCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import AddIcon from "@material-ui/icons/Add";
import ViewListIcon from "@material-ui/icons/ViewList";
import React from "react";
import styled from "styled-components";
import i18n from "../../../utils/i18n";
import i18n from "$/utils/i18n";

export const MenuCard: React.FC<MenuCardProps> = React.memo(
({ name, description, addAction, listAction = () => {} }) => {
Expand Down
2 changes: 1 addition & 1 deletion src/webapp/components/page-header/PageHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Typography from "@material-ui/core/Typography";
import { DialogButton } from "@eyeseetea/d2-ui-components";
import React, { PropsWithChildren } from "react";
import styled from "styled-components";
import i18n from "../../../utils/i18n";
import i18n from "$/utils/i18n";

export const PageHeader: React.FC<PageHeaderProps> = React.memo(props => {
const { variant = "h5", title, onBackClick, helpText, children } = props;
Expand Down
4 changes: 2 additions & 2 deletions src/webapp/contexts/app-context.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useContext } from "react";
import { CompositionRoot } from "../../CompositionRoot";
import { User } from "../../domain/entities/User";
import { CompositionRoot } from "$/CompositionRoot";
import { User } from "$/domain/entities/User";

export interface AppContextState {
currentUser: User;
Expand Down
10 changes: 5 additions & 5 deletions src/webapp/pages/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { MuiThemeProvider } from "@material-ui/core/styles";
//@ts-ignore
import OldMuiThemeProvider from "material-ui/styles/MuiThemeProvider";
import React, { useEffect, useState } from "react";
import { appConfig } from "../../../app-config";
import { CompositionRoot } from "../../../CompositionRoot";
import Share from "../../components/share/Share";
import { AppContext, AppContextState } from "../../contexts/app-context";
import { Router } from "../Router";
import { appConfig } from "$/app-config";
import { CompositionRoot } from "$/CompositionRoot";
import Share from "$/webapp/components/share/Share";
import { AppContext, AppContextState } from "$/webapp/contexts/app-context";
import { Router } from "$/webapp/pages/Router";
import "./App.css";
import muiThemeLegacy from "./themes/dhis2-legacy.theme";
import { muiTheme } from "./themes/dhis2.theme";
Expand Down
4 changes: 2 additions & 2 deletions src/webapp/pages/app/Dhis2App.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from "react";
import i18n from "@dhis2/d2-i18n";
import { Provider } from "@dhis2/app-runtime";
import { D2Api } from "../../../types/d2-api";
import { D2Api } from "$/types/d2-api";
import App from "./App";
import { CompositionRoot, getWebappCompositionRoot } from "../../../CompositionRoot";
import { CompositionRoot, getWebappCompositionRoot } from "$/CompositionRoot";

export function Dhis2App(_props: {}) {
const [compositionRootRes, setCompositionRootRes] = React.useState<CompositionRootResult>({
Expand Down
4 changes: 2 additions & 2 deletions src/webapp/pages/app/__tests__/App.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { fireEvent, render } from "@testing-library/react";

import App from "../App";
import { getTestContext } from "../../../../utils/tests";
import App from "$/webapp/pages/app/App";
import { getTestContext } from "$/utils/tests";
import { Provider } from "@dhis2/app-runtime";

describe("App", () => {
Expand Down
4 changes: 2 additions & 2 deletions src/webapp/pages/example/ExamplePage.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from "react";
import { useHistory } from "react-router-dom";
import styled from "styled-components";
import i18n from "../../../utils/i18n";
import { PageHeader } from "../../components/page-header/PageHeader";
import i18n from "$/utils/i18n";
import { PageHeader } from "$/webapp/components/page-header/PageHeader";

export const ExamplePage: React.FC<ExamplePageProps> = React.memo(props => {
const { name } = props;
Expand Down
4 changes: 2 additions & 2 deletions src/webapp/pages/example/__tests__/ExamplePage.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getReactComponent } from "../../../../utils/tests";
import { ExamplePage } from "../../example/ExamplePage";
import { getReactComponent } from "$/utils/tests";
import { ExamplePage } from "$/webapp/pages/example/ExamplePage";

describe("ExamplePage", () => {
it("renders the feedback component", async () => {
Expand Down
4 changes: 2 additions & 2 deletions src/webapp/pages/landing/LandingPage.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Typography } from "@material-ui/core";
import React from "react";
import { useHistory } from "react-router-dom";
import { Card, CardGrid } from "../../components/card-grid/CardGrid";
import { useAppContext } from "../../contexts/app-context";
import { Card, CardGrid } from "$/webapp/components/card-grid/CardGrid";
import { useAppContext } from "$/webapp/contexts/app-context";

export const LandingPage: React.FC = React.memo(() => {
const history = useHistory();
Expand Down

0 comments on commit bb3ecb5

Please sign in to comment.