Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production Deployment #88

Merged
merged 47 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
f01e83b
Update mockuphone header image
YayunHuang Aug 12, 2024
9dca34f
Update title in title case
YayunHuang Aug 12, 2024
31322d2
Fix cannot upload image on tv issue
YayunHuang Aug 12, 2024
cb7bc40
Fix device details page rwd
YayunHuang Aug 12, 2024
773b7e0
Update home page section alignment
YayunHuang Aug 12, 2024
eff6157
MPR Update mockuphone header image
pkong-ds Aug 12, 2024
0ac7444
MPR Update title in title case
pkong-ds Aug 12, 2024
79b9694
MPR Update home page section alignment
pkong-ds Aug 12, 2024
90ef298
MPR Fix cannot upload image on tv issue
pkong-ds Aug 12, 2024
0c6e11c
MPR Fix device details page rwd
pkong-ds Aug 12, 2024
8541659
Allow select .jpeg file from file picker
YayunHuang Aug 12, 2024
208c725
MPR Allow select .jpeg file from file picker
pkong-ds Aug 12, 2024
f8857d6
Add padding to prevent weird triangles at corners
YayunHuang Aug 13, 2024
77c3d3d
Fix missing image when share to facebook
YayunHuang Aug 12, 2024
af89a8e
MPR Fix missing image when share to facebook
pkong-ds Aug 13, 2024
5b552e6
Update about us page content
YayunHuang Aug 13, 2024
0c87bdf
Add padding to prevent weird triangles at corners
pkong-ds Aug 14, 2024
acbcb8a
Adjust image position for galaxy s24 ultra
YayunHuang Aug 14, 2024
2a5d68c
Adjust image position for apple watch ultra 2
YayunHuang Aug 14, 2024
f8eba4f
MPR Adjust image position for apple watch ultra 2
pkong-ds Aug 14, 2024
084dc2e
MPR Adjust image position for galaxy s24 ultra
pkong-ds Aug 14, 2024
cbea25d
Auto download mockup when navigating to download page
YayunHuang Aug 14, 2024
8717483
Update download btn copywriting
YayunHuang Aug 14, 2024
55443d5
MPR Auto download mockup on navigating to download page
pkong-ds Aug 14, 2024
5d5451a
Update use case page ui
YayunHuang Aug 13, 2024
5ea4ac9
MPR Update use case page ui
pkong-ds Aug 14, 2024
acc9153
Update Images folder name to images
YayunHuang Aug 15, 2024
c431da9
Adjust image position for apple watch ultra 2 blue landscape
YayunHuang Aug 15, 2024
298dad5
MPR Update about us page content
pkong-ds Aug 15, 2024
4bbe2bc
MPR Adjust image position for apple watch ultra 2 blue landscape
pkong-ds Aug 15, 2024
8a3633e
MPR Update Images folder name to images
pkong-ds Aug 15, 2024
034dada
Add images for developer tools page
YayunHuang Aug 14, 2024
2d5b900
Update developer tools page ui
YayunHuang Aug 14, 2024
5f847c6
Extract DeveloperToolCard
YayunHuang Aug 14, 2024
0a88425
Restructure developerTools page
YayunHuang Aug 15, 2024
fb6084e
MPR Update developer tools page
pkong-ds Aug 15, 2024
776a209
Fix non-existent `npm ci` script as `make ci`
pkong-ds Aug 15, 2024
bace9cb
MPR Fix non-existent `npm ci` script as `make ci`
YayunHuang Aug 15, 2024
eb506ff
Fix images broken due to astro pathing
pkong-ds Aug 15, 2024
477c2e5
Remove ci in cd first
pkong-ds Aug 15, 2024
c107fc5
MPR Remove ci in cd first
YayunHuang Aug 15, 2024
6a17f93
MPR Fix images broken due to astro pathing
YayunHuang Aug 15, 2024
3eac2b0
Run npm install in cd
pkong-ds Aug 15, 2024
34666d7
Update python mockup packages in public folder
pkong-ds Aug 15, 2024
d26280b
MPR Run npm install in cd
YayunHuang Aug 15, 2024
3a72c64
MPR Update python mockup packages in public folder
YayunHuang Aug 15, 2024
2caf66f
Fix forward image path
pkong-ds Aug 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PUBLIC_BASE_URL=https://mockuphone.com
1 change: 1 addition & 0 deletions .env.staging
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PUBLIC_BASE_URL=https://staging.mockuphone.com
3 changes: 2 additions & 1 deletion .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm ci
- name: Set env to staging/production
run: |
if [[ "${{ github.ref_name }}" == "main" ]]; then
echo "ENV=staging" >> $GITHUB_ENV
elif [[ "${{ github.ref_name }}" == "production" ]]; then
echo "ENV=production" >> $GITHUB_ENV
fi
- name: Install npm packages
run: npm install
- name: Build html
run: npm run build
- name: Deploy
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ pnpm-debug.log*

# environment variables
.env
.env.production

# macOS-specific files
.DS_Store
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ Now, in your terminal:

### Add device image

1. Place the portrait and landscape image as `{device_id}-portrait.png` and `{device_id}-landscape.png` in `public/Images/mockup_templates/`
2. Run `make create-mask-image` to create mask image to `public/Images/mockup_mask_templates/`
3. Run `make add-new-device`, and input device info, this script will let user use `{device_id}-portrait.png` in `public/Images/mockup_mask_templates/` to get the frame of the image
1. Place the portrait and landscape image as `{device_id}-portrait.png` and `{device_id}-landscape.png` in `public/images/mockup_templates/`
2. Run `make create-mask-image` to create mask image to `public/images/mockup_mask_templates/`
3. Run `make add-new-device`, and input device info, this script will let user use `{device_id}-portrait.png` in `public/images/mockup_mask_templates/` to get the frame of the image
- The script will ask you to input some info for the device, after input the device info, you should see a window as below:
- <img width="756" alt="Screenshot 2023-09-01 at 2 31 31 PM" src="https://github.com/YayunHuang/mockuphone/assets/48404737/14ede2b1-7fb0-4e02-8405-386ee532539e">
- Resize the window if you can't see 4 trackbar on top
Expand Down
2 changes: 1 addition & 1 deletion add_device_scripts/add_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
device_name = input("Input device_name(ex: Samsung Galaxy S20): ")
device_type = input("Input device_type(Android/iOS/TV/Laptops/Macbook): ")

image_path = f"public/Images/mockup_mask_templates/{device_id}-portrait.png"
image_path = f"public/images/mockup_mask_templates/{device_id}-portrait.png"
img = cv2.imread(image_path)
cv2.namedWindow("image")
cv2.imshow("image", img)
Expand Down
6 changes: 3 additions & 3 deletions add_device_scripts/create_mask_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ def bfs2(image):
positionsList.append((x - 1, y))


path = "public/Images/mockup_templates"
device_path = "public/Images/devices_picture"
outputPath = "public/Images/mockup_mask_templates"
path = "public/images/mockup_templates"
device_path = "public/images/devices_picture"
outputPath = "public/images/mockup_mask_templates"
if len(sys.argv) == 1:
print("use default path ", path)
else:
Expand Down
2 changes: 1 addition & 1 deletion add_device_scripts/get_angled_device_coord.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
x1, y1, x2, y2, x3, y3, x4, y4 = 0, 0, 0, 0, 0, 0, 0, 0

image_path = input(
"Input image path\n(ex: public/Images/devices_picture/"
"Input image path\n(ex: public/images/devices_picture/"
"apple-ipadpro11-spacegrey-right.png)\n"
)
img = cv2.imread(image_path)
Expand Down
4 changes: 2 additions & 2 deletions mockup_package/mockup/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

async def mockup(location, device_id, original_img_path_list, device_info):
device_path_prefix = f"{location.split('/')[0]}//{location.split('/')[2]}"
device_mask_path_prefix = device_path_prefix + "/Images/mockup_mask_templates/"
device_path_prefix += "/Images/mockup_templates/"
device_mask_path_prefix = device_path_prefix + "/images/mockup_mask_templates/"
device_path_prefix += "/images/mockup_templates/"
device_path = "./device.png"
device_mask_path = "./device_mask.png"
output_img_path_list = []
Expand Down
18 changes: 16 additions & 2 deletions mockup_package/mockup/image_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import numpy as np


PADDING = 100


class ImageGenerator:
original_img_path = "./output.png"
resized_image_path = "./resize.png"
Expand Down Expand Up @@ -113,7 +116,16 @@ def create_fit_coord_image(self, spec):
)
distort_img = cv2.cvtColor(distort_img, cv2.COLOR_BGR2RGB)
distort_img = Image.fromarray(distort_img)
distort_img.save(self.tmp_result_image_path)

# the black border we added in `create_fit_resolution_image` may not be large enough after rotating the image # noqa: E501
# so add extra padding here to prevent weird triangles in the corners # noqa: E501
distort_img_with_padding = Image.new(
"RGBA",
(distort_img.size[0] + 2 * PADDING, distort_img.size[1] + 2 * PADDING),
(0, 0, 0, 255),
)
distort_img_with_padding.paste(distort_img, (PADDING, PADDING))
distort_img_with_padding.save(self.tmp_result_image_path)
return self.tmp_result_image_path

def caculate_min_and_max_x_y(self, spec):
Expand All @@ -139,7 +151,9 @@ def create_mockup_image(self, device_path, device_mask_path_prefix, result_path)
device_image = Image.open(device_path).convert("RGBA")

result_image = Image.new("RGBA", mask_image.size, (0, 0, 0, 0))
result_image.paste(tmp_result_image, (self.xyset[0], self.xyset[2]))
result_image.paste(
tmp_result_image, (self.xyset[0] - PADDING, self.xyset[2] - PADDING)
)
mask_image.paste(result_image, (0, 0), mask=mask_image)
mask_image.paste(device_image, (0, 0), mask=device_image)
mask_image.save(result_path)
Expand Down
Binary file removed public/Images/mockuphone-logo.png
Binary file not shown.
3 changes: 0 additions & 3 deletions public/Images/oursky/mockuphone-header.svg

This file was deleted.

File renamed without changes
File renamed without changes
3 changes: 3 additions & 0 deletions public/images/arrow-forward.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading