Skip to content

Commit

Permalink
Merge pull request #11 from caido-community/ib-tailwind
Browse files Browse the repository at this point in the history
Move to @caido/tailwindcss integration
  • Loading branch information
Corb3nik authored Oct 12, 2024
2 parents 4da3c8b + 6f11d1a commit bbe30a0
Show file tree
Hide file tree
Showing 20 changed files with 267 additions and 425 deletions.
15 changes: 0 additions & 15 deletions packages/frontend/index.html

This file was deleted.

11 changes: 6 additions & 5 deletions packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,28 @@
"license": "CC0-1.0",
"type": "module",
"scripts": {
"dev": "vite --config ./vite.config.dev.ts",
"typecheck": "vue-tsc --noEmit",
"build": "vite build"
},
"dependencies": {
"@caido/primevue": "0.1.1",
"@caido/sdk-frontend": "0.41.0",
"@fortawesome/fontawesome-free": "6.6.0",
"@vueuse/core": "10.11.1",
"pinia": "2.2.1",
"primevue": "4.0.5",
"@caido/primevue": "0.0.3",
"primevue": "4.1.0",
"shared": "workspace:*",
"vue": "3.4.37"
},
"devDependencies": {
"@codemirror/view": "6.28.1",
"@caido/sdk-backend": "0.41.0",
"@caido/tailwindcss": "0.0.1",
"@codemirror/view": "6.28.1",
"@vitejs/plugin-vue": "5.1.2",
"backend": "workspace:*",
"postcss-prefixwrap": "1.51.0",
"tailwindcss": "3.4.9",
"tailwindcss": "3.4.13",
"tailwindcss-primeui": "0.3.4",
"vue-tsc": "2.0.29"
}
}
9 changes: 9 additions & 0 deletions packages/frontend/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import tailwindcss from "tailwindcss";
import prefixwrap from "postcss-prefixwrap";

export default {
plugins: [
tailwindcss(),
prefixwrap("#plugin--authmatrix"),
],
}
17 changes: 3 additions & 14 deletions packages/frontend/src/app.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ClassicTheme, ClassicThemePassthrough } from "@caido/primevue";
import { Classic } from "@caido/primevue";
import PrimeVue from "primevue/config";
import Tooltip from "primevue/tooltip";
import { createApp } from "vue";
Expand All @@ -21,19 +21,8 @@ export const defineApp = (sdk: CaidoSDK) => {
app.use(pinia);

app.use(PrimeVue, {
theme: {
preset: ClassicTheme,
options: {
/**
* The selector to use to determine if the user has selected dark mode.
* This selector is present in the HTML of the core Caido app, not the plugin.
*/
darkModeSelector: "[data-mode=dark]",
},
},
pt: {
...ClassicThemePassthrough,
},
unstyled: true,
pt: Classic,
});

app.directive("tooltip", Tooltip);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const onTemplateUpdate = (
:pt="{ body: { class: 'flex-1 min-h-0' }, content: { class: 'h-full' } }">

<template #header>
<div class="px-4 pt-4 flex justify-between gap-8">
<div class="p-4 flex justify-between gap-8">
<div class="flex flex-col">
<h2 class="text-lg font-semibold">Templates</h2>
<p class="text-sm text-gray-400">Add template requests to the queue for analysis.</p>
Expand Down Expand Up @@ -209,14 +209,16 @@ const onTemplateUpdate = (
</template>
</Column>

<Column>
<Column header="">
<template #body="{ data }">
<div class="flex justify-end">
<Button icon="fas fa-trash" text severity="danger" size="small" @click="() => deleteTemplate(data)" />
</div>
</template>
</Column>

</DataTable>

</template>
</Card>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ const onAddRole = () => {
<template>
<Card class="h-full" :pt="{ body: { class: 'h-full' }, content: { class: 'flex-1 min-h-0' } } ">
<template #title>
<div class="flex justify-between">
<div class="flex justify-between p-4 items-center">
<div class="flex flex-col">
<h1>Roles</h1>
<p class="text-sm text-gray-400">Manage roles and their descriptions</p>
</div>

<div class="min-w-max">
<Button label="+ Add role" @click="onAddRole" />
<Button label="+ Add role" size="small" @click="onAddRole" />
</div>
</div>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const onRoleUpdate = (role: RoleDTO, field: keyof RoleDTO, value: string) => {
</template>
</Column>

<Column>
<Column header="">
<template #body="{ data }">
<div class="flex justify-end">
<Button icon="fas fa-trash" size="small" text severity="danger" @click="onDeleteRole(data)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ const onAddUser = () => {
<template>
<Card class="h-full" :pt="{ body: { class: 'h-full' }, content: { class: 'flex-1 min-h-0' } } ">
<template #title>
<div class="flex justify-between">
<div class="flex justify-between p-4 items-center">
<div class="flex flex-col w-full">
<h1>Users</h1>
<p class="text-sm text-gray-400">Manage users and their access to the system</p>
</div>
<div class="min-w-max">
<Button label="+ Add User" @click="onAddUser" />
<Button label="+ Add User" size="small" @click="onAddUser" />
</div>
</div>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const onDeleteUser = (user: UserDTO) => {
</template>
</Column>

<Column>
<Column header="">
<template #body="{ data }">
<div class="flex justify-end">
<Button icon="fas fa-trash" text severity="danger" size="small" @click="() => onDeleteUser(data)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const onAttributeUpdate = (

<template>
<div class="flex-1 flex flex-col gap-2 min-h-0">
<div class="flex justify-between items-center">
<div class="flex justify-between items-center p-4">
<h1 class="font-bold">Attributes</h1>
<div>
<Button label="+ Add attribute" size="small" @click="onAddAttribute" />
Expand Down Expand Up @@ -96,7 +96,7 @@ const onAttributeUpdate = (
</template>
</Column>

<Column>
<Column header="">
<template #body="{ data }">
<div class="flex justify-end">
<Button severity="danger" text size="small" icon="fas fa-trash" @click="() => onRemoveAttribute(data)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ watch(user, () => {
<template>
<Card class="h-full" :pt="{ body: { class: 'h-full' }, content: { class: 'flex-1 min-h-0' } } ">
<template #title>
<div class="flex justify-between items-center">
<div class="flex justify-between items-center p-4">
<h1 class="font-bold">{{ user.name }}</h1>
</div>
</template>

<template #content>
<div class="flex flex-col h-full gap-8 min-h-0">
<div class="flex flex-col gap-2">
<div class="flex flex-col gap-2 p-4">
<label for="name" class="text-sm">Name</label>
<InputText id="name" label="Name" v-model="cloned.name" autocomplete="off" @focusout="onFocusOut"/>
</div>
Expand Down
Loading

0 comments on commit bbe30a0

Please sign in to comment.