Skip to content

Commit

Permalink
Some tidying up and such
Browse files Browse the repository at this point in the history
  • Loading branch information
Willdotwhite committed Jan 5, 2024
1 parent 2b54529 commit c3d2b86
Show file tree
Hide file tree
Showing 62 changed files with 25,414 additions and 15,269 deletions.
40,422 changes: 25,344 additions & 15,078 deletions ui/package-lock.json

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "team-finder-ui",
"version": "0.0.0",
"engines": {
"node": "^16.15.0",
"npm": "^8.5.5"
"node": "^20",
"npm": "^10"
},
"scripts": {
"dev": "vite",
Expand Down Expand Up @@ -50,10 +50,9 @@
"@testing-library/react": "^14.0.0",
"@types/javascript-time-ago": "^2.0.3",
"@types/jest": "^29.5.1",
"@types/react": "^18.2.0",
"@types/react": "^18.2.45",
"@types/react-dom": "^18.2.1",
"@types/react-router-dom": "^5.3.3",
"@types/tailwindcss": "^3.0.11",
"@typescript-eslint/eslint-plugin": "^5.59.1",
"@typescript-eslint/parser": "^5.59.1",
"@vitejs/plugin-react": "^4.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Skill } from "../skill";
import type { Skill } from "../../model/skill";

export function getSkillIcon(skill: Skill) {
return `/testassets/skill-icons/${skill}.svg`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Tool } from "../tool";
import type { Tool } from "../../model/tool";

export function getToolIcon(tool: Tool) {
return `/testassets/tool-icons/${tool}.svg`;
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import {Availability, availabilityInfoMap} from "../model/availability";
import {Availability, availabilityInfoMap} from "../../model/availability";
import cx from "classnames";

// Not actually a list, currently only displays one at a time - oh well
Expand Down
1 change: 1 addition & 0 deletions ui/src/components/AvailabilityList/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { AvailabilityList } from "./AvailabilityList";
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
allAvailabilities,
Availability,
availabilityInfoMap,
} from "../model/availability";
} from "../../model/availability";

interface Props {
value: Availability[];
Expand Down
1 change: 1 addition & 0 deletions ui/src/components/AvailabilitySelector/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { AvailabilitySelector } from "./AvailabilitySelector";
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Button} from "./Button";
import {Button} from ".";
import {Meta, StoryObj} from "@storybook/react";

const meta = {
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions ui/src/components/Button/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Button } from "./Button";
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import {Language, languageInfoMap} from "../model/language";
import {Language, languageInfoMap} from "../../model/language";
import cx from "classnames";

export const LanguageList: React.FC<{
Expand Down
1 change: 1 addition & 0 deletions ui/src/components/LanguageList/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { LanguageList } from "./LanguageList";
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { StyledSelector } from "../components/StyledSelector/StyledSelector";
import {allLanguages, Language, languageInfoMap} from "../model/language";
import { StyledSelector } from "../StyledSelector/StyledSelector";
import {allLanguages, Language, languageInfoMap} from "../../model/language";

interface Props {
value: Language[];
Expand Down
1 change: 1 addition & 0 deletions ui/src/components/LanguageSelector/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { LanguageSelector } from "./LanguageSelector";
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {Meta, StoryObj} from "@storybook/react";

import {PostView} from "./PostView";
import React from "react";
import {Context} from "../Context";
import {Context} from "../../Context";

const meta = {
title: 'Post view',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import * as React from "react";
import { useNavigate } from "react-router-dom";
import { useReportPostMutation, useReportBrokenDMsPostMutation } from "../queries/posts";
import { FavouritePostIndicator } from "./FavouritePostIndicator";
import { SkillList } from "./SkillList";
import { ToolList } from "./ToolList";
import { AvailabilityList } from "./AvailabilityList";
import { LanguageList } from "./LanguageList";
import { timezoneLabelFromInt } from "../model/timezone";
import { Post } from "../model/post";
import { useAuth } from "../utils/AuthContext";
import { useReportPostMutation, useReportBrokenDMsPostMutation } from "../../queries/posts";
import { FavouritePostIndicator } from "../FavouritePostIndicator";
import { SkillList } from "../SkillList";
import { ToolList } from "../ToolList";
import { AvailabilityList } from "../AvailabilityList";
import { LanguageList } from "../LanguageList";
import { timezoneLabelFromInt } from "../../model/timezone";
import { Post } from "../../model/post";
import { useAuth } from "../../utils/AuthContext";
import { toast } from "react-hot-toast";
import { useUserInfo } from "../queries/userInfo";
import { useCreateBotDmMutation } from "../queries/bot";
import { login } from "../utils/login";
import { iiicon } from "../utils/iiicon";
import { useUserInfo } from "../../queries/userInfo";
import { useCreateBotDmMutation } from "../../queries/bot";
import { login } from "../../utils/login";
import { iiicon } from "../../utils/iiicon";

export const PostView: React.FC<{ post: Post }> = ({ post }) => {

Expand Down
1 change: 1 addition & 0 deletions ui/src/components/PostView/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { PostView } from "./PostView";
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as React from "react";
import { useParams } from "react-router-dom";
import { usePostById } from "../queries/posts";
import { Post } from "../model/post";
import { PostView } from "./PostView";
import { LoadingSpinner } from "../pages/Home/components/LoadingSpinner";
import { usePostById } from "../../queries/posts";
import { Post } from "../../model/post";
import { PostView } from "../PostView";
import { LoadingSpinner } from "../../pages/Home/components/LoadingSpinner";

export const PostViewWrapper: React.FC = () => {
const { postId } = useParams()
Expand Down
1 change: 1 addition & 0 deletions ui/src/components/PostViewWrapper/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { PostViewWrapper } from "./PostViewWrapper";
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from "react";
import { ReactSVG, Props as ReactSVGProps } from "react-svg";
import { Skill, skillInfoMap } from "../model/skill";
import { Skill, skillInfoMap } from "../../model/skill";

const transparent =
"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
Expand Down
1 change: 1 addition & 0 deletions ui/src/components/SkillIcon/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { SkillIcon } from "./SkillIcon";
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from "react";
import {Skill, skillInfoMap} from "../model/skill";
import {Skill, skillInfoMap} from "../../model/skill";
import cx from "classnames";
import {SkillIcon} from "./SkillIcon";
import {SkillIcon} from "../SkillIcon";

export const SkillList: React.FC<{
skills: Skill[];
Expand Down
1 change: 1 addition & 0 deletions ui/src/components/SkillList/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { SkillList } from "./SkillList";
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from "react";
import { SkillIcon } from "../components/SkillIcon";
import { StyledSelector } from "../components/StyledSelector/StyledSelector";
import { allSkills, Skill, skillInfoMap } from "../model/skill";
import { SkillIcon } from "../SkillIcon/SkillIcon";
import { StyledSelector } from "../StyledSelector/StyledSelector";
import { allSkills, Skill, skillInfoMap } from "../../model/skill";

interface Props {
value: Skill[];
Expand Down
1 change: 1 addition & 0 deletions ui/src/components/SkillSelector/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { SkillSelector } from "./SkillSelector";
1 change: 1 addition & 0 deletions ui/src/components/StyledSelector/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { StyledSelector } from "./StyledSelector";
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from "react";
import { StyledSelector } from "./StyledSelector/StyledSelector";
import { allTimezoneOffsets, TimezoneOffset, timezoneOffsetInfoMap } from "../model/timezone";
import { StyledSelector } from "../StyledSelector/StyledSelector";
import { allTimezoneOffsets, TimezoneOffset, timezoneOffsetInfoMap } from "../../model/timezone";

interface Props {
value: TimezoneOffset[];
Expand Down
1 change: 1 addition & 0 deletions ui/src/components/TimezoneOffsetSelector/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { TimezoneOffsetSelector } from "./TimezoneOffsetSelector";
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from "react";
import { ReactSVG, Props as ReactSVGProps } from "react-svg";
import { Tool, toolInfoMap } from "../model/tool";
import { Tool, toolInfoMap } from "../../model/tool";

const transparent =
"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
Expand Down
1 change: 1 addition & 0 deletions ui/src/components/ToolIcon/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { ToolIcon } from "./ToolIcon";
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from "react";
import {Tool, toolInfoMap} from "../model/tool";
import {Tool, toolInfoMap} from "../../model/tool";
import cx from "classnames";
import {ToolIcon} from "./ToolIcon";
import {ToolIcon} from "../ToolIcon";

export const ToolList: React.FC<{
tools: Tool[];
Expand Down
1 change: 1 addition & 0 deletions ui/src/components/ToolList/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { ToolList } from "./ToolList";
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from "react";
import { ToolIcon } from "../components/ToolIcon";
import { StyledSelector } from "../components/StyledSelector/StyledSelector";
import { allTools, Tool, toolInfoMap } from "../model/tool";
import { ToolIcon } from "../ToolIcon";
import { StyledSelector } from "../StyledSelector/StyledSelector";
import { allTools, Tool, toolInfoMap } from "../../model/tool";

interface Props {
value: Tool[];
Expand Down
1 change: 1 addition & 0 deletions ui/src/components/ToolSelector/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { ToolSelector } from "./ToolSelector";
4 changes: 2 additions & 2 deletions ui/src/model/skillIcons.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Skill } from "./skill";

const skillIcons: Record<string, any> = import.meta.glob("./skill-icons-assets/*.svg", { eager: true });
const skillIcons: Record<string, any> = import.meta.glob("../assets/skill-icons-assets/*.svg", { eager: true });

export function getSkillIcon(skill: Skill) {
// TODO: This should be either imported using the correct type or properly type checked
return skillIcons[`./skill-icons-assets/${skill}.svg`].default;
return skillIcons[`../assets/skill-icons-assets/${skill}.svg`].default;
}
4 changes: 2 additions & 2 deletions ui/src/model/toolIcons.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Tool } from "./tool";

const toolIcons: Record<string, any> = import.meta.glob("./tool-icons-assets/*.svg", { eager: true });
const toolIcons: Record<string, any> = import.meta.glob("../assets/tool-icons-assets/*.svg", { eager: true });

export function getToolIcon(tool: Tool) {
return toolIcons[`./tool-icons-assets/${tool}.svg`].default;
return toolIcons[`../assets/tool-icons-assets/${tool}.svg`].default;
}
8 changes: 4 additions & 4 deletions ui/src/pages/Home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ import { isSkill } from "../../model/skill";
import { SearchOptions, usePostsList } from "../../queries/posts";
import { useUpdateSearchParam } from "../../utils/searchParam";
import { useThrottleState } from "../../utils/throttleState";
import { SkillSelector } from "../SkillSelector";
import { ToolSelector } from "../ToolSelector";
import { SkillSelector } from "../../components/SkillSelector";
import { ToolSelector } from "../../components/ToolSelector";
import { isTool } from "../../model/tool";
import { AvailabilitySelector } from "../AvailabilitySelector";
import { AvailabilitySelector } from "../../components/AvailabilitySelector";
import { isAvailability } from "../../model/availability";
import { Onboarding } from "./components/Onboarding";
import { useEffect, useState } from "react";
import { ViewOptions } from "./components/ViewOptions";
import { isLanguage } from "../../model/language";
import { LanguageSelector } from "../LanguageSelector";
import { LanguageSelector } from "../../components/LanguageSelector";
import { TimezoneOffsetSelector } from "../../components/TimezoneOffsetSelector";
import { allTimezoneOffsets, TimezoneOffset, timezoneOffsetToInt } from "../../model/timezone";
import { LoadingSpinner } from "./components/LoadingSpinner";
Expand Down
8 changes: 4 additions & 4 deletions ui/src/pages/MyPost/MyPost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import {
useMyPostQuery
} from "../../queries/my-post";
import { useEnsureLoggedIn } from "../../utils/useEnsureLoggedIn";
import { AvailabilitySelector } from "../AvailabilitySelector";
import { AvailabilitySelector } from "../../components/AvailabilitySelector";
import { allAvailabilities, Availability } from "../../model/availability";
import { SkillSelector } from "../SkillSelector";
import { SkillSelector } from "../../components/SkillSelector";
import { Skill } from "../../model/skill";
import { ToolSelector } from "../ToolSelector";
import { ToolSelector } from "../../components/ToolSelector";
import { Tool } from "../../model/tool";
import { useUserInfo } from "../../queries/userInfo";
import { IncorrectPermsSetModal } from "./IncorrectPermsSetModal";
import { LanguageSelector } from "../LanguageSelector";
import { LanguageSelector } from "../../components/LanguageSelector";
import { Language } from "../../model/language";
import { TimezoneOffsetSelector} from "../../components/TimezoneOffsetSelector";
import { TimezoneOffset, timezoneOffsetFromInt } from "../../model/timezone";
Expand Down
9 changes: 0 additions & 9 deletions ui/src/utils/ArrayToRecord.ts

This file was deleted.

7 changes: 0 additions & 7 deletions ui/src/utils/UserInfo.ts

This file was deleted.

7 changes: 0 additions & 7 deletions ui/src/utils/__mocks__/importMeta.ts

This file was deleted.

14 changes: 0 additions & 14 deletions ui/src/utils/limitNewlines.ts

This file was deleted.

Loading

0 comments on commit c3d2b86

Please sign in to comment.