chore: some changes and run prettier everywhere

dev
Antonio De Lucreziis 8 months ago
parent 182238f89d
commit f16e340fd2

@ -1,3 +1,18 @@
/**
* @typedef {{
* image?: string,
* course?: string,
* title?: string,
* author: string,
* courseYear: string
* }} AppuntiCardProps
*/
/**
*
* @param {AppuntiCardProps} param0
* @returns
*/
export const AppuntiCard = ({ image, course, title, author, courseYear }) => { export const AppuntiCard = ({ image, course, title, author, courseYear }) => {
return ( return (
<div class="appunti-item"> <div class="appunti-item">

@ -1,5 +1,5 @@
import { drizzle } from "drizzle-orm/better-sqlite3"; import { drizzle } from 'drizzle-orm/better-sqlite3'
import Database from "better-sqlite3"; import Database from 'better-sqlite3'
const sql = new Database("out/website.sqlite"); const sql = new Database('out/website.sqlite')
export const db = drizzle(sql); export const db = drizzle(sql)

@ -1,4 +1,4 @@
import { migrate } from "drizzle-orm/better-sqlite3/migrator"; import { migrate } from 'drizzle-orm/better-sqlite3/migrator'
import { db } from "./index"; import { db } from './index'
migrate(db, { migrationsFolder: "out/drizzle" }); migrate(db, { migrationsFolder: 'out/drizzle' })

@ -1,9 +1,9 @@
import { sql } from "drizzle-orm"; import { sql } from 'drizzle-orm'
import { text, sqliteTable } from "drizzle-orm/sqlite-core"; import { text, sqliteTable } from 'drizzle-orm/sqlite-core'
export const users = sqliteTable("users", { export const users = sqliteTable('users', {
// id è l'id unico di questo utente, non è modificabile una volta creato l'utente. // id è l'id unico di questo utente, non è modificabile una volta creato l'utente.
id: text("id") id: text('id')
.primaryKey() .primaryKey()
.default(sql`(lower(hex(randomblob(16))))`), .default(sql`(lower(hex(randomblob(16))))`),
@ -14,30 +14,30 @@ export const users = sqliteTable("users", {
// chiesto se usare quello dell'account che sta usando o se cambiarlo // chiesto se usare quello dell'account che sta usando o se cambiarlo
// (in teoria non dovrebbe essere un problema poterlo modificare // (in teoria non dovrebbe essere un problema poterlo modificare
// successivamente). // successivamente).
username: text("username").unique().notNull(), username: text('username').unique().notNull(),
// FullName da mostrare in giro per il sito // FullName da mostrare in giro per il sito
fullName: text("fullname"), fullName: text('fullname'),
// Email per eventuale contatto // Email per eventuale contatto
email: text("email"), email: text('email'),
}); })
export type User = typeof users.$inferSelect; // return type when queried export type User = typeof users.$inferSelect // return type when queried
export type InsertUser = typeof users.$inferInsert; // insert type export type InsertUser = typeof users.$inferInsert // insert type
export const accounts = sqliteTable("accounts", { export const accounts = sqliteTable('accounts', {
// id è l'id unico di questo account, non è modificabile una volta creato l'account. // id è l'id unico di questo account, non è modificabile una volta creato l'account.
id: text("id").primaryKey(), id: text('id').primaryKey(),
userId: text("userId") userId: text('userId')
.notNull() .notNull()
.references(() => users.id), .references(() => users.id),
provider: text("provider").$type<"poisson" | "ateneo">().notNull(), provider: text('provider').$type<'poisson' | 'ateneo'>().notNull(),
token: text("token").notNull(), token: text('token').notNull(),
}); })
export type Account = typeof accounts.$inferSelect; // return type when queried export type Account = typeof accounts.$inferSelect // return type when queried
export type InsertAccount = typeof accounts.$inferInsert; // insert type export type InsertAccount = typeof accounts.$inferInsert // insert type

@ -14,7 +14,7 @@ import { AppuntiList, AppuntiCard } from '@client/Appunti'
<h2>In primo piano</h2> <h2>In primo piano</h2>
<div class="appunti-scrollable center"> <div class="appunti-scrollable center">
<AppuntiList> <AppuntiList>
<AppuntiCard client:load title="Appunti 1" author="someuser" courseYear="2023/2024" /> <AppuntiCard client:load title="Appunti 1" author="someuser" courseYear="2023/2024" />
<AppuntiCard client:load course="Geometria 1" author="exampleuser" courseYear="2023/2024" /> <AppuntiCard client:load course="Geometria 1" author="exampleuser" courseYear="2023/2024" />
@ -28,15 +28,15 @@ import { AppuntiList, AppuntiCard } from '@client/Appunti'
<div class="appunti-scrollable"> <div class="appunti-scrollable">
<AppuntiList> <AppuntiList>
<AppuntiCard client:load title="Appunti 1" author="example" courseYear="2023/2024" /> <AppuntiCard client:load title="Appunti 1" author="example" courseYear="2023/2024" />
<AppuntiCard client:load title="Appunti 1" author="example" courseYear="2023/2024" /> <AppuntiCard client:load title="Appunti 1" author="example" courseYear="2023/2024" />
<AppuntiCard client:load title="Appunti 1" author="example" courseYear="2023/2024" /> <AppuntiCard client:load title="Appunti 1" author="example" courseYear="2023/2024" />
<AppuntiCard client:load title="Appunti 1" author="example" courseYear="2023/2024" /> <AppuntiCard client:load title="Appunti 1" author="example" courseYear="2023/2024" />
<AppuntiCard client:load title="Appunti 1" author="example" courseYear="2023/2024" /> <AppuntiCard client:load title="Appunti 1" author="example" courseYear="2023/2024" />
<AppuntiCard client:load title="Appunti 1" author="example" courseYear="2023/2024" /> <AppuntiCard client:load title="Appunti 1" author="example" courseYear="2023/2024" />
<AppuntiCard client:load title="Appunti 1" author="example" courseYear="2023/2024" /> <AppuntiCard client:load title="Appunti 1" author="example" courseYear="2023/2024" />
<AppuntiCard client:load title="Appunti 1" author="example" courseYear="2023/2024" /> <AppuntiCard client:load title="Appunti 1" author="example" courseYear="2023/2024" />
</AppuntiList> </AppuntiList>
</div> </div>
<h3>Algebra Lineare</h3> <h3>Algebra Lineare</h3>
@ -61,5 +61,4 @@ import { AppuntiList, AppuntiCard } from '@client/Appunti'
<AppuntiCard client:load title="Appunti 1" author="example" courseYear="2023/2024" /> <AppuntiCard client:load title="Appunti 1" author="example" courseYear="2023/2024" />
</AppuntiList> </AppuntiList>
</div> </div>
</PageLayout> </PageLayout>

@ -275,14 +275,14 @@ const DIR_AVAILABLE_PREDICATE: Record<WireDirection, (pos: Point2, grid: Grid<Wi
function pruneDirections( function pruneDirections(
grid: Grid<WireCell>, grid: Grid<WireCell>,
position: Point2, position: Point2,
directions: WireDirection[] directions: WireDirection[],
): WireDirection[] { ): WireDirection[] {
return directions.filter(dir => DIR_AVAILABLE_PREDICATE[dir](position, grid)) return directions.filter(dir => DIR_AVAILABLE_PREDICATE[dir](position, grid))
} }
function generateWire( function generateWire(
grid: Grid<WireCell>, grid: Grid<WireCell>,
startingPoint: Point2 startingPoint: Point2,
): { position: Point2; direction: WireCell }[] { ): { position: Point2; direction: WireCell }[] {
const segmentLength = Math.floor(1 - Math.random() ** 2) * 10 + 30 const segmentLength = Math.floor(1 - Math.random() ** 2) * 10 + 30
let currentPosition = startingPoint let currentPosition = startingPoint

@ -12,7 +12,11 @@ $news-accent-bg: #f8e8b1;
place-content: center; place-content: center;
font-size: 24px; font-size: 24px;
font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24; font-variation-settings:
'FILL' 0,
'wght' 300,
'GRAD' 0,
'opsz' 24;
} }
.search { .search {
@ -26,7 +30,7 @@ $news-accent-bg: #f8e8b1;
align-items: center; align-items: center;
cursor: pointer; cursor: pointer;
background: #fff; background: #fff;
&:hover, &:hover,

@ -1,4 +1,3 @@
@function pow($number, $exponent) { @function pow($number, $exponent) {
$value: 1; $value: 1;
@ -17,7 +16,7 @@
@for $i from 1 through 5 { @for $i from 1 through 5 {
$factor: pow($heading-scale, 5 - $i); $factor: pow($heading-scale, 5 - $i);
h#{$i} { h#{$i} {
font-size: $base-font-size * $factor; font-size: $base-font-size * $factor;
font-family: 'Source Sans Pro', monospace; font-family: 'Source Sans Pro', monospace;
@ -71,7 +70,6 @@
} }
} }
p { p {
line-height: 1.65; line-height: 1.65;
margin: 0.5rem auto; margin: 0.5rem auto;
@ -91,4 +89,4 @@
margin: 0 0.75rem; margin: 0 0.75rem;
} }
} }
} }

@ -1,6 +1,7 @@
{ {
"extends": "astro/tsconfigs/strict", "extends": "astro/tsconfigs/strict",
"compilerOptions": { "compilerOptions": {
"strict": false,
"jsx": "react-jsx", "jsx": "react-jsx",
"jsxImportSource": "preact", "jsxImportSource": "preact",
"strictNullChecks": true, "strictNullChecks": true,
@ -9,7 +10,7 @@
"paths": { "paths": {
"@/*": ["src/*"], "@/*": ["src/*"],
"@layouts/*": ["src/layouts/*"], "@layouts/*": ["src/layouts/*"],
"@client/*": ["src/client/*"], "@client/*": ["src/client/*"]
} }
} }
} }

Loading…
Cancel
Save