Skip to content

Commit

Permalink
format files
Browse files Browse the repository at this point in the history
  • Loading branch information
MutazAshhab committed Sep 4, 2023
1 parent 5c01edc commit ee02c90
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 27 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ jobs:
- name: Install dependencies
run: pnpm install
# TODO: lint seems to be broken for now
# - name: Lint
# run: pnpm lint
# - name: Lint
# run: pnpm lint
# TODO: type check prevent build for now
# - name: Type check
# run: pnpm type-check
# - name: Type check
# run: pnpm type-check
- name: Build
run: pnpm build
- name: Save files
Expand All @@ -39,4 +39,4 @@ jobs:
path: |
LICENSE
README.md
dist
dist
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"pretty": "prettier --check . --ignore-path=./.prettierignore",
"pretty": "prettier --write . --ignore-path=./.prettierignore",
"type-check": "tsc --noEmit",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
Expand Down
2 changes: 1 addition & 1 deletion src/colors.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const roadColor = 'grey';
export const centerlineColor = 'white';
export const highlightColor = '#FFAE42';
export const highlightColor = '#FFAE42';
3 changes: 1 addition & 2 deletions src/components/Canvas/Intersection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ export function Intersection({ node }: IntersectionProps) {
const baseIntersectionSize = 25;

function handleDragMove(event: KonvaEventObject<DragEvent>) {

const updatedNode = {
...network.nodes[node.id],
x: event.target.x(),
y: event.target.y()
y: event.target.y(),
};

network.updateNode(node.id, updatedNode);
Expand Down
17 changes: 9 additions & 8 deletions src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ import { useState } from 'react';
import { Dialog } from '@headlessui/react';
import { Bars3Icon, XMarkIcon } from '@heroicons/react/20/solid';

import { useNetworkStore } from '~/zustand/useNetworkStore';

import Logo from '../assets/UrbanFloLogoB&W.svg';
import { ProjectDownloadButton } from './ProjectDownloadButton';
import { ProjectUploadButton } from './ProjectUploadButton';
import { useNetworkStore } from '~/zustand/useNetworkStore';

export function classNames(...classes: string[]) {
return classes.filter(Boolean).join(' ');
}

export function Header() {
const network = useNetworkStore()
const network = useNetworkStore();
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);

return (
Expand All @@ -30,11 +31,11 @@ export function Header() {
|
</span>
<input
className='ml-8 pl-2 flex items-center gap-x-1 text-sm font-semibold leading-6 text-gray-900 focus: border-amber-400'
type="string"
value={network.documentName.replace(".json", "")}
onChange={e => network.setDocumentName(e.target.value)}
/>
className="ml-8 pl-2 flex items-center gap-x-1 text-sm font-semibold leading-6 text-gray-900 focus: border-amber-400"
type="string"
value={network.documentName.replace('.json', '')}
onChange={e => network.setDocumentName(e.target.value)}
/>
</div>
<div className="flex lg:hidden">
<button
Expand All @@ -48,7 +49,7 @@ export function Header() {
</div>

<div className="hidden lg:flex lg:flex-1 lg:justify-end space-x-4">
<ProjectDownloadButton />
<ProjectDownloadButton />

<ProjectUploadButton />
</div>
Expand Down
3 changes: 1 addition & 2 deletions src/components/ProjectDownloadButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import useJsonDownloader from '~/hooks/useJsonDownloader';
import { getUrbanFloFileContents } from '~/logic/urbanflo-file-logic';
import { useNetworkStore } from '~/zustand/useNetworkStore';


export function ProjectDownloadButton() {
const downloadJson = useJsonDownloader();
const network = useNetworkStore()
const network = useNetworkStore();
function handleDownloadClick() {
const jsonString = getUrbanFloFileContents();
downloadJson(jsonString, network.documentName);
Expand Down
2 changes: 1 addition & 1 deletion src/components/ProjectUploadButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function ProjectUploadButton() {
function handleFileUpload(event: React.ChangeEvent<HTMLInputElement>) {
const file = event.target.files?.[0];
if (file && file.type === 'application/json') {
networkStore.setDocumentName(file.name)
networkStore.setDocumentName(file.name);
const reader = new FileReader();
reader.onload = (e: ProgressEvent<FileReader>) => {
try {
Expand Down
8 changes: 3 additions & 5 deletions src/components/SideBar.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { XMarkIcon } from '@heroicons/react/24/outline';

import { RoadPropertiesEditor } from '~/components/Editors/RoadProperties';
import { ModalViewNames, useLeftSideBar } from '~/zustand/useLeftSideBar';
import {
XMarkIcon
} from '@heroicons/react/24/outline'


export function LeftSideBar() {
const leftSideBar = useLeftSideBar();
Expand Down Expand Up @@ -47,7 +45,7 @@ export function LeftSideBar() {
onClick={leftSideBar.close}
style={{ justifyContent: 'flex-end' }} // Align button contents to the right
>
<XMarkIcon className="h-6 w-6 mb-2 justify-end" aria-hidden="true" />
<XMarkIcon className="h-6 w-6 mb-2 justify-end" aria-hidden="true" />
</button>
{getView()}
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/zustand/useNetworkStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ export interface Network extends NetworkData {
}

export const useNetworkStore = create<Network>(set => ({
documentName: "Untitled Document",
documentName: 'Untitled Document',
nodes: {},
edges: {},
connections: {},
vType: {},
route: {},
flow: {},
grid: {},
setDocumentName: (name) => {
setDocumentName: name => {
set({ documentName: name });
},
addNode: (node: Node) =>
Expand Down

0 comments on commit ee02c90

Please sign in to comment.