forked from nfelger/achill
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1546ec8
commit c19e041
Showing
7 changed files
with
198 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { ButtonColor } from "~/utils/colors"; | ||
|
||
interface Props { | ||
text: string; | ||
testId: string; | ||
onClick: () => void; | ||
color: ButtonColor; | ||
} | ||
|
||
export function TroiButton({ text, testId, onClick, color }: Props) { | ||
return ( | ||
<button | ||
onClick={onClick} | ||
data-testid={testId} | ||
className={`ease rounded ${color.idle} text-s px-6 py-2.5 font-medium text-white shadow-md transition duration-150 ease-in-out hover:${color.hover} hover:shadow-lg focus:${color.hover} focus:shadow-lg focus:outline-none focus:ring-0 active:${color.active} active:shadow-lg`} | ||
> | ||
{text} | ||
</button> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { ActionFunctionArgs } from "@remix-run/node"; | ||
import TroiApiService from "troi-library"; | ||
import { login } from "~/cookies.server"; | ||
|
||
export async function action({ request, params }: ActionFunctionArgs) { | ||
if (!params.id) { | ||
throw new Error("entry id required"); | ||
} | ||
|
||
const cookieHeader = request.headers.get("Cookie"); | ||
const cookie = (await login.parse(cookieHeader)) || {}; | ||
|
||
const troi = new TroiApiService({ | ||
baseUrl: "https://digitalservice.troi.software/api/v2/rest", | ||
clientName: "DigitalService GmbH des Bundes", | ||
username: cookie.username, | ||
password: cookie.password, | ||
}); | ||
|
||
await troi.deleteTimeEntry(Number.parseInt(params.id)); | ||
return params.id; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
export interface ButtonColor { | ||
idle: string; | ||
hover: string; | ||
active: string; | ||
} | ||
|
||
export const buttonBlue: ButtonColor = { | ||
idle: "bg-blue-600", | ||
hover: "bg-blue-700", | ||
active: "bg-blue-800", | ||
}; | ||
|
||
export const buttonRed: ButtonColor = { | ||
idle: "bg-red-600", | ||
hover: "bg-red-700", | ||
active: "bg-red-800", | ||
}; | ||
|
||
export const buttonGreen: ButtonColor = { | ||
idle: "bg-green-600", | ||
hover: "bg-green-700", | ||
active: "bg-green-800", | ||
}; |