Skip to content

Commit

Permalink
feat: add button for renaming image (#97)
Browse files Browse the repository at this point in the history
* chore: implement shadcn/ui

* feat: add rename-modal

* feat: implement rename-modal

* feat: implement shadcn/ui

* feat: handleRenameFile function

* chore: dismiss eslint errors

* chore: add props to RenameModal component

* feat: add functionality to renameModal component

* refactor: use src/ directory (#98)

* refactor: move folders to src/

* fix: import alias @
  • Loading branch information
kevinanielsen authored Jan 22, 2024
1 parent 3b7f5e1 commit 022002c
Show file tree
Hide file tree
Showing 47 changed files with 1,104 additions and 212 deletions.
8 changes: 4 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"os"

"github.com/gin-gonic/gin"
"github.com/kevinanielsen/go-fast-cdn/database"
ini "github.com/kevinanielsen/go-fast-cdn/initializers"
"github.com/kevinanielsen/go-fast-cdn/router"
"github.com/kevinanielsen/go-fast-cdn/util"
"github.com/kevinanielsen/go-fast-cdn/src/database"
ini "github.com/kevinanielsen/go-fast-cdn/src/initializers"
"github.com/kevinanielsen/go-fast-cdn/src/router"
"github.com/kevinanielsen/go-fast-cdn/src/util"
)

func init() {
Expand Down
6 changes: 3 additions & 3 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"testing"

"github.com/gin-gonic/gin"
"github.com/kevinanielsen/go-fast-cdn/database"
ini "github.com/kevinanielsen/go-fast-cdn/initializers"
"github.com/kevinanielsen/go-fast-cdn/util"
"github.com/kevinanielsen/go-fast-cdn/src/database"
ini "github.com/kevinanielsen/go-fast-cdn/src/initializers"
"github.com/kevinanielsen/go-fast-cdn/src/util"
)

func setup() {
Expand Down
4 changes: 2 additions & 2 deletions database/database.go → src/database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"os"

"github.com/glebarez/sqlite"
"github.com/kevinanielsen/go-fast-cdn/models"
"github.com/kevinanielsen/go-fast-cdn/util"
"github.com/kevinanielsen/go-fast-cdn/src/models"
"github.com/kevinanielsen/go-fast-cdn/src/util"
"gorm.io/gorm"
)

Expand Down
2 changes: 1 addition & 1 deletion database/doc.go → src/database/doc.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package database

import (
"github.com/kevinanielsen/go-fast-cdn/models"
"github.com/kevinanielsen/go-fast-cdn/src/models"
)

func AddDoc(fileName string, fileHashBuffer []byte) (string, bool) {
Expand Down
2 changes: 1 addition & 1 deletion database/image.go → src/database/image.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package database

import (
"github.com/kevinanielsen/go-fast-cdn/models"
"github.com/kevinanielsen/go-fast-cdn/src/models"
)

func AddImage(fileName string, fileHashBuffer []byte) (string, bool) {
Expand Down
2 changes: 1 addition & 1 deletion database/migrate.go → src/database/migrate.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package database

import "github.com/kevinanielsen/go-fast-cdn/models"
import "github.com/kevinanielsen/go-fast-cdn/src/models"

// Migrate runs database migrations for all model structs using
// the global DB instance. This would typically be called on app startup.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"os"

"github.com/gin-gonic/gin"
"github.com/kevinanielsen/go-fast-cdn/database"
"github.com/kevinanielsen/go-fast-cdn/models"
"github.com/kevinanielsen/go-fast-cdn/src/database"
"github.com/kevinanielsen/go-fast-cdn/src/models"
)

func HandleDropDB(c *gin.Context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"net/http"

"github.com/gin-gonic/gin"
"github.com/kevinanielsen/go-fast-cdn/database"
"github.com/kevinanielsen/go-fast-cdn/models"
"github.com/kevinanielsen/go-fast-cdn/src/database"
"github.com/kevinanielsen/go-fast-cdn/src/models"
)

func HandleAllDocs(c *gin.Context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"os"

"github.com/gin-gonic/gin"
"github.com/kevinanielsen/go-fast-cdn/database"
"github.com/kevinanielsen/go-fast-cdn/util"
"github.com/kevinanielsen/go-fast-cdn/src/database"
"github.com/kevinanielsen/go-fast-cdn/src/util"
)

func HandleDocDelete(c *gin.Context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"os"
"path/filepath"

"github.com/kevinanielsen/go-fast-cdn/util"
"github.com/kevinanielsen/go-fast-cdn/src/util"

"github.com/gin-gonic/gin"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"path/filepath"
"testing"

"github.com/kevinanielsen/go-fast-cdn/util"
"github.com/kevinanielsen/go-fast-cdn/src/util"

"github.com/gin-gonic/gin"
"github.com/google/uuid"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"path/filepath"

"github.com/gin-gonic/gin"
"github.com/kevinanielsen/go-fast-cdn/database"
"github.com/kevinanielsen/go-fast-cdn/util"
"github.com/kevinanielsen/go-fast-cdn/src/database"
"github.com/kevinanielsen/go-fast-cdn/src/util"
)

func HandleDocUpload(c *gin.Context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"path/filepath"

"github.com/gin-gonic/gin"
"github.com/kevinanielsen/go-fast-cdn/database"
"github.com/kevinanielsen/go-fast-cdn/util"
"github.com/kevinanielsen/go-fast-cdn/src/database"
"github.com/kevinanielsen/go-fast-cdn/src/util"
)

func HandleDocsRename(c *gin.Context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"path/filepath"

"github.com/gin-gonic/gin"
"github.com/kevinanielsen/go-fast-cdn/util"
"github.com/kevinanielsen/go-fast-cdn/src/util"
)

func GetSizeHandler(c *gin.Context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"net/http"

"github.com/gin-gonic/gin"
"github.com/kevinanielsen/go-fast-cdn/database"
"github.com/kevinanielsen/go-fast-cdn/models"
"github.com/kevinanielsen/go-fast-cdn/src/database"
"github.com/kevinanielsen/go-fast-cdn/src/models"
)

func HandleAllImages(c *gin.Context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"os"

"github.com/gin-gonic/gin"
"github.com/kevinanielsen/go-fast-cdn/database"
"github.com/kevinanielsen/go-fast-cdn/util"
"github.com/kevinanielsen/go-fast-cdn/src/database"
"github.com/kevinanielsen/go-fast-cdn/src/util"
)

func HandleImageDelete(c *gin.Context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package handlers

import (
"errors"
"github.com/gin-gonic/gin"
"github.com/kevinanielsen/go-fast-cdn/util"
"image"
"log"
"net/http"
"os"
"path/filepath"

"github.com/gin-gonic/gin"
"github.com/kevinanielsen/go-fast-cdn/src/util"
)

func HandleImageMetadata(c *gin.Context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"testing"

"github.com/gin-gonic/gin"
"github.com/kevinanielsen/go-fast-cdn/util"
"github.com/kevinanielsen/go-fast-cdn/src/util"
"github.com/stretchr/testify/require"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"path/filepath"

"github.com/gin-gonic/gin"
"github.com/kevinanielsen/go-fast-cdn/database"
"github.com/kevinanielsen/go-fast-cdn/util"
"github.com/kevinanielsen/go-fast-cdn/src/database"
"github.com/kevinanielsen/go-fast-cdn/src/util"
)

func HandleImageRename(c *gin.Context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/anthonynsimon/bild/imgio"
"github.com/anthonynsimon/bild/transform"
"github.com/gin-gonic/gin"
"github.com/kevinanielsen/go-fast-cdn/util"
"github.com/kevinanielsen/go-fast-cdn/src/util"
)

// TODO: add logging package
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"path/filepath"

"github.com/gin-gonic/gin"
"github.com/kevinanielsen/go-fast-cdn/database"
"github.com/kevinanielsen/go-fast-cdn/util"
"github.com/kevinanielsen/go-fast-cdn/src/database"
"github.com/kevinanielsen/go-fast-cdn/src/util"
)

func HandleImageUpload(c *gin.Context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"os"

"github.com/kevinanielsen/go-fast-cdn/util"
"github.com/kevinanielsen/go-fast-cdn/src/util"
)

func CreateFolders() {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions router/api.go → src/router/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"net/http"

"github.com/gin-gonic/gin"
"github.com/kevinanielsen/go-fast-cdn/handlers"
dbHandlers "github.com/kevinanielsen/go-fast-cdn/handlers/db"
dHandlers "github.com/kevinanielsen/go-fast-cdn/handlers/docs"
iHandlers "github.com/kevinanielsen/go-fast-cdn/handlers/image"
"github.com/kevinanielsen/go-fast-cdn/util"
"github.com/kevinanielsen/go-fast-cdn/src/handlers"
dbHandlers "github.com/kevinanielsen/go-fast-cdn/src/handlers/db"
dHandlers "github.com/kevinanielsen/go-fast-cdn/src/handlers/docs"
iHandlers "github.com/kevinanielsen/go-fast-cdn/src/handlers/image"
"github.com/kevinanielsen/go-fast-cdn/src/util"
)

func AddApiRoutes(r *gin.Engine) {
Expand Down
2 changes: 1 addition & 1 deletion router/router.go → src/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"os"

"github.com/gin-gonic/gin"
"github.com/kevinanielsen/go-fast-cdn/middleware"
"github.com/kevinanielsen/go-fast-cdn/src/middleware"
"github.com/kevinanielsen/go-fast-cdn/ui"
)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions ui/components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": false,
"tsx": true,
"tailwind": {
"config": "tailwind.config.js",
"css": "src/index.css",
"baseColor": "slate",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
}
11 changes: 9 additions & 2 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,16 @@
"test": "playwright test"
},
"dependencies": {
"lucide-react": "^0.294.0",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-slot": "^1.0.2",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"lucide-react": "^0.312.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"tailwind-merge": "^2.2.0",
"tailwindcss-animate": "^1.0.7"
},
"devDependencies": {
"@playwright/test": "^1.40.1",
Expand Down
Loading

0 comments on commit 022002c

Please sign in to comment.