Skip to content

Commit

Permalink
Fix/bugs (#47)
Browse files Browse the repository at this point in the history
* Fix #45

Fix #39

Fix #35

Fix #37

* Resolve #38

* Resolve #40

* Fix #44

* Fix test
  • Loading branch information
andrewwippler authored Mar 31, 2023
1 parent 414c29c commit ada6ab5
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 5 deletions.
4 changes: 3 additions & 1 deletion api/tests/functional/place.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,12 @@ test.group('Place', (group) => {

const response = await client.post(`/places/${illustration.id}`).bearerToken(loggedInUser.body().token).json(place)
response.assertStatus(200)

// console.log(response.body())
assert.equal(response.body().message, 'Created successfully')
assert.equal(response.body().place.user_id,goodUser.id)
assert.isNumber(response.body().id)
const savedPlace = await Place.find(response.body().id)
assert.equal(savedPlace.user_id,goodUser.id)

})

Expand Down
Binary file removed frontend/public/GitHub-Mark-32px.png
Binary file not shown.
Binary file removed frontend/public/GitHub-Mark-Light-32px.png
Binary file not shown.
Binary file modified frontend/public/favicon.ico
Binary file not shown.
1 change: 0 additions & 1 deletion frontend/public/next.svg

This file was deleted.

1 change: 0 additions & 1 deletion frontend/public/thirteen.svg

This file was deleted.

1 change: 0 additions & 1 deletion frontend/public/vercel.svg

This file was deleted.

14 changes: 13 additions & 1 deletion frontend/src/components/Flash.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { Transition } from '@headlessui/react'
import { useAppSelector, useAppDispatch } from '@/hooks'
import { useTimeoutFn } from 'react-use'
import { selectFlash, setFlash, selectFlashMessage } from '@/features/flash/reducer'
import { useEffect, useState } from 'react'
export default function Flash() {

const flashOpen = useAppSelector(selectFlash)
const flash = useAppSelector(selectFlashMessage)
const dispatch = useAppDispatch()

useTimeoutFn(() => dispatch(setFlash(false)), 3500)
const handleClose = () => {
dispatch(setFlash(false))
};
Expand All @@ -32,6 +32,18 @@ export default function Flash() {
info: 'border-blue-500',
}

useEffect(() => {
const timeId = setTimeout(() => {
handleClose()
}, 2500)

return () => {
clearTimeout(timeId)
}
}, [flashOpen]);

if (!flashOpen) return <></>

return (
<div className="flex mt-4 items-center justify-center px-4 sm:px-6 lg:px-8">
<div className="w-full max-w-screen-lg">
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/components/TagSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ export default function TagSelect({ defaultValue }:{ defaultValue: string | tagT
handleTagAdd(inputRef.current.value)
}
}
if (event.key === 'Tab') {
// so then no tabbing to content? :(
event.preventDefault()
if (inputRef.current) {
// @ts-ignore
handleTagAdd(filteredTags[0].name)
}
}
}

const handleTagAutoCompleteClicked = (event: any) : void => {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/features/tags/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const tagReducer = createSlice({
// Remove duplicate tags, must include space to - conversion
if (!state.tags) {
state.tags = [actions.payload]
return
}
if (!state.tags.some(item => item.name === actions.payload.name.replace(/ /g, '-'))) {
state.tags = [...state.tags, actions.payload]
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/pages/illustration/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { selectIllustrationEdit, setIllustrationEdit, selectUpdateUI, setUpdateU
import format from 'date-fns/format';
import PlaceConfirmDialog from '@/components/PlaceConfirmDialog';
import { placeType } from '@/library/placeType';
import Head from 'next/head';

export default function IllustrationWrapper() {
const router = useRouter()
Expand Down Expand Up @@ -102,6 +103,9 @@ export default function IllustrationWrapper() {

return (
<Layout>
<Head>
<title>SW | {illustration?.title}</title>
</Head>
{editIllustration ?
<IllustrationForm illustration={illustration} />
:
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/pages/tag/[name].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Layout from '@/components/Layout';
import ConfirmDialog from '@/components/ConfirmDialog';
import { PencilSquareIcon, CheckCircleIcon, TrashIcon } from '@heroicons/react/24/solid'
import { FormEvent } from 'react';
import Head from 'next/head';

import { useAppSelector, useAppDispatch } from '@/hooks'
import { selectModal, setModal } from '@/features/modal/reducer'
Expand Down Expand Up @@ -81,6 +82,9 @@ export default function Tag() {

return (
<Layout>
<Head>
<title>SW | {name}</title>
</Head>
<div className="text-xl font-bold pb-4 text-sky-900">
{editTag ?
<form className="mt-8 space-y-6" onSubmit={handleSave}>
Expand Down

0 comments on commit ada6ab5

Please sign in to comment.