chore: Fixing linter warnings
This commit is contained in:
parent
d3a87ad7d1
commit
f9e3236253
37 changed files with 46 additions and 694 deletions
|
@ -34,7 +34,7 @@ export default function (part) {
|
|||
let body16_17d = 152.51537318250902 * options.size
|
||||
let body17_18d = 255.15294373571314 * options.size
|
||||
let body18_19d = 71.90453921693678 * options.size
|
||||
let body19_01d = 61.33021195137026 * options.size
|
||||
//let body19_01d = 61.33021195137026 * options.size
|
||||
|
||||
let body01cp1d = 32.13103487929059 * options.size
|
||||
let body01cp2d = 23.72518967258217 * options.size
|
||||
|
|
|
@ -56,7 +56,7 @@ export default function (part) {
|
|||
let diff = 0
|
||||
let angle = 0
|
||||
do {
|
||||
if (length?.o) angle = diff*( length.o > length.i ? -.1 : .1 )
|
||||
if (length.o) angle = diff*( length.o > length.i ? -.1 : .1 )
|
||||
|
||||
points.dartBottomRight = points.dartBottomRight.rotate( angle, points.waistSide )
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
export default function (part) {
|
||||
let {
|
||||
utils,
|
||||
const {
|
||||
store,
|
||||
sa,
|
||||
Point,
|
||||
|
@ -10,7 +9,6 @@ export default function (part) {
|
|||
Snippet,
|
||||
snippets,
|
||||
options,
|
||||
measurements,
|
||||
complete,
|
||||
paperless,
|
||||
macro,
|
||||
|
@ -171,7 +169,7 @@ export default function (part) {
|
|||
to: points.hps,
|
||||
y: points.hps.y - sa - 15,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return part
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
export default function (part) {
|
||||
let {
|
||||
utils,
|
||||
const {
|
||||
store,
|
||||
sa,
|
||||
Point,
|
||||
points,
|
||||
Path,
|
||||
paths,
|
||||
Snippet,
|
||||
snippets,
|
||||
options,
|
||||
measurements,
|
||||
complete,
|
||||
paperless,
|
||||
macro,
|
||||
|
@ -154,7 +151,7 @@ export default function (part) {
|
|||
to: points.shoulderDartOutside,
|
||||
x: pLeft.x -sa - 15,
|
||||
})
|
||||
|
||||
|
||||
let pArmholeLeft = paths.armhole.edge('left')
|
||||
macro('hd', {
|
||||
from: points.waistDartRight,
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
export default function (part) {
|
||||
let {
|
||||
utils,
|
||||
store,
|
||||
sa,
|
||||
Point,
|
||||
const {
|
||||
points,
|
||||
Path,
|
||||
paths,
|
||||
Snippet,
|
||||
snippets,
|
||||
options,
|
||||
measurements,
|
||||
complete,
|
||||
paperless,
|
||||
macro,
|
||||
} = part.shorthand()
|
||||
|
||||
|
@ -227,7 +219,6 @@ export default function (part) {
|
|||
.rotate(-2.5, points.shoulderDartOutside)
|
||||
.shiftFractionTowards(points.shoulderDartOutside, 0.2)
|
||||
|
||||
let lInside = shoulderInsideSeam.length()
|
||||
let iteration = 1
|
||||
let diff = 0
|
||||
do {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { version } from '../package.json'
|
||||
import freesewing from '@freesewing/core'
|
||||
import configHelpers from '@freesewing/config-helpers'
|
||||
const { elastics, pctBasedOn } = configHelpers
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { version } from '../package.json'
|
||||
import freesewing from '@freesewing/core'
|
||||
import configHelpers from '@freesewing/config-helpers'
|
||||
const { elastics, pctBasedOn } = configHelpers
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { version } from '../package.json'
|
||||
import freesewing from '@freesewing/core'
|
||||
import configHelpers from '@freesewing/config-helpers'
|
||||
const { smallsteps, pctBasedOn } = configHelpers
|
||||
|
||||
|
|
|
@ -1,270 +1,4 @@
|
|||
export default function (part) {
|
||||
const {
|
||||
options,
|
||||
Point,
|
||||
Path,
|
||||
points,
|
||||
paths,
|
||||
measurements,
|
||||
// Snippet,
|
||||
// snippets,
|
||||
store,
|
||||
utils,
|
||||
complete,
|
||||
sa,
|
||||
paperless,
|
||||
macro,
|
||||
} = part.shorthand()
|
||||
const method = part => part
|
||||
|
||||
// Design pattern here
|
||||
export default method
|
||||
|
||||
// Create points
|
||||
return part
|
||||
points.backWaistMid = new Point(measurements.seat / 4, 0)
|
||||
points.backWaistBandLeft = new Point(
|
||||
store.get('sideSeamWaist').x / options.backToFrontWidth,
|
||||
store.get('sideSeamWaist').y
|
||||
)
|
||||
points.backLegOpeningLeft = new Point(
|
||||
store.get('sideSeamHip').x / options.backToFrontWidth,
|
||||
store.get('sideSeamHip').y
|
||||
)
|
||||
|
||||
// back height is given by (estimated) cross seam, minus front and gusset lengths
|
||||
// this does not account for vertical stretch yet
|
||||
const backHeight = store.get('crossSeam') - store.get('frontHeight') - options.gussetLength * measurements.seat
|
||||
|
||||
// calculate the actual back height, using yScale above and yScaleReduced below leg opening
|
||||
const backHeightAbove = store.get('frontHeightAbove') // part above has same height front and back
|
||||
|
||||
let backHeightBelow
|
||||
backHeightBelow = store.get('yScale')*(backHeight - backHeightAbove/store.get('yScaleReduced'))
|
||||
|
||||
const backHeightReduced = backHeightBelow + backHeightAbove
|
||||
|
||||
points.backGussetLeft = new Point(
|
||||
measurements.seat / 4 -
|
||||
((measurements.waist * options.gussetWidth * store.get('xScale')) / options.gussetRatio) *
|
||||
options.backToFrontWidth,
|
||||
backHeightReduced
|
||||
)
|
||||
points.backGussetMid = new Point(
|
||||
measurements.seat / 4,
|
||||
backHeightReduced
|
||||
)
|
||||
|
||||
points.backGussetRight = points.backGussetLeft.flipX(points.backWaistMid)
|
||||
points.backLegOpeningRight = points.backLegOpeningLeft.flipX(points.backWaistMid)
|
||||
points.backWaistBandRight = points.backWaistBandLeft.flipX(points.backWaistMid)
|
||||
|
||||
points.backWaistBandMid = points.backWaistBandLeft
|
||||
.shiftFractionTowards(points.backWaistBandRight, 0.5)
|
||||
.shift(270, measurements.waistToUpperLeg * options.backDip)
|
||||
|
||||
/* Middle point for label */
|
||||
points.backMidMid = points.backLegOpeningLeft.shiftFractionTowards(
|
||||
points.backLegOpeningRight,
|
||||
0.5
|
||||
)
|
||||
|
||||
// Create control points
|
||||
|
||||
/* Control point for waistband dip */
|
||||
points.backWaistBandLeftCp1 = points.backWaistBandMid.shift(0,points.backWaistBandMid.dx(points.backWaistBandLeft) / 3 )
|
||||
|
||||
/* Flip points to right side */
|
||||
points.backWaistBandRightCp1 = points.backWaistBandLeftCp1.flipX(points.backWaistMid)
|
||||
|
||||
// Shape back coverage
|
||||
|
||||
/* Only have to do this on one side */
|
||||
points.backLegOpeningCorner = utils.beamsIntersect(
|
||||
points.backLegOpeningLeft,
|
||||
points.backLegOpeningLeft.shift(180, points.backGussetLeft.dy(points.backLegOpeningLeft)),
|
||||
points.backGussetLeft,
|
||||
points.backGussetLeft.shift(270, points.backGussetLeft.dy(points.backLegOpeningLeft))
|
||||
)
|
||||
|
||||
if (options.backExposure >= 0) {
|
||||
/* If back exposure is high, like a thong style */
|
||||
/* This controls the hip bit */
|
||||
points.backLegOpeningLeftCp1 = points.backLegOpeningLeft.shiftFractionTowards(
|
||||
points.backLegOpeningCorner,
|
||||
options.backExposure
|
||||
)
|
||||
/* This controls the center bit */
|
||||
points.backGussetLeftCp1 = points.backGussetLeft.shiftFractionTowards(
|
||||
points.backWaistBandMid,
|
||||
options.backExposure
|
||||
)
|
||||
points.backGussetLeft = points.backGussetLeft.shiftFractionTowards(
|
||||
points.backGussetMid,
|
||||
options.backExposure
|
||||
) // This narrows the back of the gusset
|
||||
points.backGussetRight = points.backGussetLeft.flipX(points.backWaistMid)
|
||||
} else {
|
||||
/* If back exposure is low and flares out to cover more */
|
||||
store.set('adjustedBackExposure',options.backExposure * store.get('adjustedLegOpening')) // flare depends on leg opening
|
||||
/* This controls the hip bit */
|
||||
points.backLegOpeningLeftCp1 = points.backLegOpeningLeft.shift(
|
||||
-45,store.get('adjustedBackExposure') * points.backWaistBandMid.dx(points.backWaistBandLeft))
|
||||
/* This controls the taper to gusset */
|
||||
points.backGussetLeftCp1 = points.backGussetLeft.shift(115, store.get('adjustedBackExposure') * points.backWaistBandMid.dx(points.backWaistBandLeft))
|
||||
|
||||
/* center of the flare and its control points are on a line parallel to the backGussetLeft to backLegOpeningLeft line
|
||||
* first, define the points on that line */
|
||||
points.backFlare = points.backGussetLeft.shiftFractionTowards(points.backLegOpeningLeft, 0.5)
|
||||
// points.backFlareCp1 = points.backGussetLeft.shiftFractionTowards(points.backLegOpeningLeft, 0.5 - store.get('adjustedBackExposure'))
|
||||
points.backFlareCp1 = points.backGussetLeft.shiftFractionTowards(points.backLegOpeningLeft, 0.7)
|
||||
points.backFlareCp2 = points.backGussetLeft.shiftFractionTowards(points.backLegOpeningLeft, 0.3)
|
||||
/* then shift all three points outward */
|
||||
points.backFlareLeft = points.backFlare.shift(
|
||||
215,(points.backWaistBandMid.dx(points.backWaistBandLeft)) * store.get('adjustedBackExposure') * 2 )
|
||||
points.backFlareLeftCp1 = points.backFlareCp1.shift(
|
||||
215,(points.backWaistBandMid.dx(points.backWaistBandLeft)) * store.get('adjustedBackExposure') * 2 )
|
||||
points.backFlareLeftCp2 = points.backFlareCp2.shift(
|
||||
215,(points.backWaistBandMid.dx(points.backWaistBandLeft)) * store.get('adjustedBackExposure') * 2 )
|
||||
|
||||
|
||||
/* Flip points to the right */
|
||||
|
||||
points.backFlareRight = points.backFlareLeft.flipX(points.backWaistBandMid)
|
||||
points.backFlareRightCp1 = points.backFlareLeftCp1.flipX(points.backWaistMid)
|
||||
points.backFlareRightCp2 = points.backFlareLeftCp2.flipX(points.backWaistMid)
|
||||
}
|
||||
|
||||
/* Flip points to the right */
|
||||
|
||||
points.backLegOpeningRightCp1 = points.backLegOpeningLeftCp1.flipX(points.backWaistMid)
|
||||
points.backGussetRightCp1 = points.backGussetLeftCp1.flipX(points.backWaistMid)
|
||||
|
||||
// Draw paths
|
||||
|
||||
if (options.backExposure >= 0) {
|
||||
paths.seam = new Path()
|
||||
.move(points.backWaistBandMid)
|
||||
.curve(points.backWaistBandLeftCp1, points.backWaistBandLeft, points.backWaistBandLeft) // Waist band dip
|
||||
.line(points.backLegOpeningLeft)
|
||||
.curve(points.backLegOpeningLeftCp1, points.backGussetLeftCp1, points.backGussetLeft)
|
||||
.line(points.backGussetMid)
|
||||
.line(points.backGussetRight)
|
||||
.curve(points.backGussetRightCp1, points.backLegOpeningRightCp1, points.backLegOpeningRight)
|
||||
.line(points.backWaistBandRight)
|
||||
.curve(points.backWaistBandRight, points.backWaistBandRightCp1, points.backWaistBandMid) // Waist band dip
|
||||
.close()
|
||||
.attr('class', 'fabric')
|
||||
} else {
|
||||
paths.seam = new Path()
|
||||
.move(points.backWaistBandMid)
|
||||
.curve(points.backWaistBandLeftCp1, points.backWaistBandLeft, points.backWaistBandLeft) // Waist band dip
|
||||
.line(points.backLegOpeningLeft)
|
||||
.curve(points.backLegOpeningLeftCp1, points.backFlareLeftCp1, points.backFlareLeft)
|
||||
.curve(points.backFlareLeftCp2, points.backGussetLeftCp1, points.backGussetLeft)
|
||||
.line(points.backGussetMid)
|
||||
.line(points.backGussetRight)
|
||||
.curve(points.backGussetRightCp1, points.backFlareRightCp2, points.backFlareRight)
|
||||
.curve(points.backFlareRightCp1, points.backLegOpeningRightCp1, points.backLegOpeningRight)
|
||||
.line(points.backWaistBandRight)
|
||||
.curve(points.backWaistBandRight, points.backWaistBandRightCp1, points.backWaistBandMid) // Waist band dip
|
||||
.close()
|
||||
.attr('class', 'fabric')
|
||||
}
|
||||
|
||||
// Store points for use in other parts
|
||||
|
||||
/* Store gusset points for use in gusset */
|
||||
|
||||
store.set('backGussetLeft', points.backGussetLeft)
|
||||
store.set('backGussetRight', points.backGussetRight)
|
||||
|
||||
/* Store lengths for use in elastic */
|
||||
|
||||
paths.backLegOpening = (options.backExposure >= 0)
|
||||
? new Path()
|
||||
.move(points.backGussetRight)
|
||||
.curve(points.backGussetRightCp1, points.backLegOpeningRightCp1, points.backLegOpeningRight)
|
||||
.setRender(false)
|
||||
: new Path()
|
||||
.move(points.backGussetRight)
|
||||
.curve(points.backGussetRightCp1, points.backFlareRightCp2, points.backFlareRight)
|
||||
.curve(points.backFlareRightCp1, points.backLegOpeningRightCp1, points.backLegOpeningRight)
|
||||
.setRender(false)
|
||||
store.set('backLegOpeningLength',paths.backLegOpening.length())
|
||||
|
||||
paths.backWaistBand = new Path()
|
||||
.move(points.backWaistBandRight)
|
||||
.curve(points.backWaistBandRightCp1, points.backWaistBandLeftCp1, points.backWaistBandLeft)
|
||||
.setRender(false)
|
||||
store.set('backWaistBandLength',paths.backWaistBand.length())
|
||||
|
||||
// Complete?
|
||||
if (complete) {
|
||||
if (sa) {
|
||||
paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa')
|
||||
}
|
||||
}
|
||||
|
||||
macro('title', {
|
||||
at: points.backMidMid,
|
||||
nr: 2,
|
||||
title: 'back',
|
||||
})
|
||||
|
||||
macro('grainline', {
|
||||
from: points.backGussetMid,
|
||||
to: points.backGussetMid.shiftFractionTowards(points.backWaistBandMid, 0.4),
|
||||
})
|
||||
|
||||
points.scaleboxAnchor = points.scalebox = points.backMidMid.shift(90, -50)
|
||||
macro('miniscale', { at: points.scalebox })
|
||||
|
||||
// Paperless?
|
||||
if (paperless) {
|
||||
macro('hd', {
|
||||
from: points.backWaistBandRight,
|
||||
to: points.backWaistBandLeft,
|
||||
y: points.backWaistBandRight.y + sa - 15,
|
||||
})
|
||||
macro('hd', {
|
||||
from: points.backLegOpeningRight,
|
||||
to: points.backLegOpeningLeft,
|
||||
y: points.backLegOpeningRight.y + sa - 15,
|
||||
})
|
||||
macro('hd', {
|
||||
from: points.backGussetLeft,
|
||||
to: points.backGussetRight,
|
||||
y: points.backGussetLeft.y + sa + 15,
|
||||
})
|
||||
macro('vd', {
|
||||
from: points.backWaistBandMid,
|
||||
to: points.backGussetMid,
|
||||
x: points.backWaistBandMid.x + sa + 15,
|
||||
})
|
||||
if (options.backExposure >= 0) {
|
||||
macro('pd', {
|
||||
path: new Path()
|
||||
.move(points.backGussetRight)
|
||||
.curve(
|
||||
points.backGussetRightCp1,
|
||||
points.backLegOpeningRightCp1,
|
||||
points.backLegOpeningRight
|
||||
),
|
||||
d: 15,
|
||||
})
|
||||
} else {
|
||||
macro('pd', {
|
||||
path: new Path()
|
||||
.move(points.backGussetRight)
|
||||
.curve(points.backGussetRightCp1, points.backFlareRightCp2, points.backFlareRight)
|
||||
.curve(
|
||||
points.backFlareRightCp1,
|
||||
points.backLegOpeningRightCp1,
|
||||
points.backLegOpeningRight
|
||||
),
|
||||
d: 15,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return part
|
||||
}
|
||||
|
|
|
@ -1,80 +1,4 @@
|
|||
export default function (part) {
|
||||
let { options, Point, Path, points, paths, measurements, store, complete, sa, paperless, macro } =
|
||||
part.shorthand()
|
||||
return part
|
||||
var yScaleDoubleLayer
|
||||
yScaleDoubleLayer = (1 + store.get('yScale'))/2 // double layer of fabric stretches half as much
|
||||
const method = part => part
|
||||
|
||||
// Create points
|
||||
points.frontGussetLeft = new Point(store.get('frontGussetLeft').x, 0)
|
||||
points.backGussetLeft = new Point(
|
||||
store.get('backGussetLeft').x,
|
||||
measurements.seat * options.gussetLength * yScaleDoubleLayer
|
||||
)
|
||||
points.frontGussetRight = new Point(store.get('frontGussetRight').x, 0)
|
||||
points.backGussetRight = new Point(
|
||||
store.get('backGussetRight').x,
|
||||
measurements.seat * options.gussetLength * yScaleDoubleLayer
|
||||
)
|
||||
export default method
|
||||
|
||||
// Create control points
|
||||
points.gussetCp1 = points.frontGussetLeft
|
||||
.shiftFractionTowards(points.backGussetLeft, 0.5)
|
||||
.shift(180, points.frontGussetRight.x / -15)
|
||||
|
||||
// Flip points to right side
|
||||
points.gussetCp2 = points.gussetCp1.flipX(store.get('frontGussetMid'))
|
||||
|
||||
// Create point for title
|
||||
points.frontMidMid = points.gussetCp1.shiftFractionTowards(points.gussetCp2, 0.5)
|
||||
|
||||
/* Store lengths for use in elastic */
|
||||
paths.gussetLegOpening = new Path()
|
||||
.move(points.backGussetRight)
|
||||
.curve(points.backGussetRight, points.gussetCp2, points.frontGussetRight)
|
||||
.setRender(false)
|
||||
store.set('gussetSideLength', paths.gussetLegOpening.length())
|
||||
|
||||
// Draw paths
|
||||
paths.seam = new Path()
|
||||
.move(points.frontGussetLeft)
|
||||
.curve(points.gussetCp1, points.backGussetLeft, points.backGussetLeft)
|
||||
.line(points.backGussetRight)
|
||||
.curve(points.backGussetRight, points.gussetCp2, points.frontGussetRight)
|
||||
.line(points.frontGussetLeft) // Without this, doesn't generate seam allowance
|
||||
.close()
|
||||
.attr('class', 'fabric')
|
||||
|
||||
// Complete?
|
||||
if (complete) {
|
||||
if (sa) {
|
||||
paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa')
|
||||
}
|
||||
macro('title', {
|
||||
at: points.frontMidMid,
|
||||
nr: 3,
|
||||
title: 'gusset',
|
||||
})
|
||||
}
|
||||
|
||||
// Paperless?
|
||||
if (paperless) {
|
||||
macro('hd', {
|
||||
from: points.frontGussetLeft,
|
||||
to: points.frontGussetRight,
|
||||
y: points.frontGussetLeft.y + sa + 15,
|
||||
})
|
||||
macro('hd', {
|
||||
from: points.backGussetLeft,
|
||||
to: points.backGussetRight,
|
||||
y: points.backGussetLeft.y + sa + 15,
|
||||
})
|
||||
macro('vd', {
|
||||
from: points.frontGussetRight,
|
||||
to: points.backGussetRight,
|
||||
x: points.frontGussetRight.x + sa + 15,
|
||||
})
|
||||
}
|
||||
|
||||
return part
|
||||
}
|
||||
|
|
|
@ -1,19 +1,11 @@
|
|||
export default function (part) {
|
||||
let {
|
||||
options,
|
||||
Point,
|
||||
Path,
|
||||
const {
|
||||
points,
|
||||
paths,
|
||||
measurements,
|
||||
Snippet,
|
||||
snippets,
|
||||
store,
|
||||
utils,
|
||||
complete,
|
||||
sa,
|
||||
paperless,
|
||||
macro,
|
||||
} = part.shorthand()
|
||||
|
||||
points.waist2 = points.backWaistBandMid
|
||||
|
|
|
@ -1,17 +1,10 @@
|
|||
export default function (part) {
|
||||
let {
|
||||
options,
|
||||
Point,
|
||||
Path,
|
||||
const {
|
||||
points,
|
||||
paths,
|
||||
measurements,
|
||||
Snippet,
|
||||
snippets,
|
||||
store,
|
||||
utils,
|
||||
complete,
|
||||
sa,
|
||||
paperless,
|
||||
macro,
|
||||
} = part.shorthand()
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
export default function (part) {
|
||||
let {
|
||||
options,
|
||||
const {
|
||||
Point,
|
||||
Path,
|
||||
points,
|
||||
paths,
|
||||
measurements,
|
||||
Snippet,
|
||||
snippets,
|
||||
store,
|
||||
utils,
|
||||
complete,
|
||||
sa,
|
||||
paperless,
|
||||
macro,
|
||||
} = part.shorthand()
|
||||
|
||||
// draw markers to indicate elastic distribution
|
||||
if ((store.get('numLegMarkersFront') < 1) & (store.get('numLegMarkersGusset') > 0)) {
|
||||
if ((store.get('numLegMarkersFront') < 1) && (store.get('numLegMarkersGusset') > 0)) {
|
||||
// draw first marker, on gusset
|
||||
// use (1 - frac) because the path is drawn from back to front
|
||||
points.leg1L = paths.gussetLegOpening.shiftFractionAlong(1 - store.get('legMarker1Frac'))
|
||||
|
@ -27,7 +21,7 @@ export default function (part) {
|
|||
snippets.leg1R = new Snippet('notch', points.leg1R)
|
||||
}
|
||||
if (
|
||||
(store.get('numLegMarkersFront') < 2) &
|
||||
(store.get('numLegMarkersFront') < 2) &&
|
||||
(store.get('numLegMarkersFront') + store.get('numLegMarkersGusset') > 1)
|
||||
) {
|
||||
// draw second marker, on gusset
|
||||
|
@ -39,7 +33,7 @@ export default function (part) {
|
|||
snippets.leg2R = new Snippet('notch', points.leg2R)
|
||||
}
|
||||
if (
|
||||
(store.get('numLegMarkersFront') < 3) &
|
||||
(store.get('numLegMarkersFront') < 3) &&
|
||||
(store.get('numLegMarkersFront') + store.get('numLegMarkersGusset') > 3)
|
||||
) {
|
||||
// draw third marker, on gusset
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import path from 'path'
|
||||
import chalk from 'chalk'
|
||||
import { banner } from './banner.mjs'
|
||||
import {
|
||||
checkNodeVersion,
|
||||
|
@ -20,34 +18,6 @@ export const cli = async () => {
|
|||
const choices = await getChoices()
|
||||
|
||||
// Create environment from template
|
||||
const result = createEnvironment(choices)
|
||||
createEnvironment(choices)
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
|
||||
const dest = await createLibrary(params)
|
||||
|
||||
console.log(`
|
||||
🎉 ${strings[params.language]['cfp.patternCreated']} ${chalk.bold(dest)}
|
||||
|
||||
${strings[params.language]['cfp.runTheseCommands']}:
|
||||
|
||||
👉 ${chalk.cyan(`cd ${path.join(params.shortName, 'example')} && ${params.manager} start`)}
|
||||
|
||||
${strings[params.language]['cfp.startWebpack']}
|
||||
|
||||
${strings[params.language]['cfp.devDocsAvailableAt']}
|
||||
${chalk.bold('https://freesewing.dev/')}
|
||||
|
||||
${strings[params.language]['cfp.talkToUs']}
|
||||
${chalk.bold('https://discord.freesewing.org/')}
|
||||
|
||||
`
|
||||
)
|
||||
|
||||
return dest
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { config } from './config.mjs'
|
||||
import { mkdir, readFile, writeFile, copyFile } from 'node:fs/promises'
|
||||
import { join, resolve, dirname, extname } from 'path'
|
||||
import { join, dirname } from 'path'
|
||||
import mustache from 'mustache'
|
||||
import rdir from 'recursive-readdir'
|
||||
import chalk from 'chalk'
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
import { useState, useEffect } from 'react'
|
||||
import Logo from 'shared/components/logos/freesewing.js'
|
||||
import Link from 'next/link'
|
||||
import ThemePicker from 'shared/components/theme-picker.js'
|
||||
import LocalePicker from 'shared/components/locale-picker.js'
|
||||
import CloseIcon from 'shared/components/icons/close.js'
|
||||
import MenuIcon from 'shared/components/icons/menu.js'
|
||||
import DocsIcon from 'shared/components/icons/docs.js'
|
||||
import HelpIcon from 'shared/components/icons/help.js'
|
||||
import { useTranslation } from 'next-i18next'
|
||||
|
||||
const Right = props => (
|
||||
|
|
|
@ -1,59 +1,7 @@
|
|||
import React from 'react'
|
||||
import { useRouter } from 'next/router'
|
||||
import Link from 'next/link'
|
||||
// Shared components
|
||||
import Logo from 'shared/components/logos/freesewing.js'
|
||||
import Aside from 'shared/components/navigation/aside'
|
||||
import get from 'lodash.get'
|
||||
import { BeforeNav } from './lab'
|
||||
|
||||
const PageTitle = ({ app, slug, title }) => {
|
||||
if (title) return <h1>{title}</h1>
|
||||
if (slug) return <h1>{get(app.navigation, slug.split('/')).__title}</h1>
|
||||
|
||||
return <h1>FIXME: This page has no title</h1>
|
||||
}
|
||||
|
||||
const Breadcrumbs = ({ app, slug=false, title }) => {
|
||||
if (!slug) return null
|
||||
const crumbs = []
|
||||
const chunks = slug.split('/')
|
||||
for (const i in chunks) {
|
||||
const j = parseInt(i)+parseInt(1)
|
||||
const page = get(app.navigation, chunks.slice(0,j))
|
||||
if (page) crumbs.push([page.__linktitle, '/'+chunks.slice(0,j).join('/'), (j < chunks.length)])
|
||||
}
|
||||
|
||||
return (
|
||||
<ul className="flex flex-row flex-wrap gap-2 font-bold">
|
||||
<li>
|
||||
<Link href="/">
|
||||
<a title="To the homepage" className="text-base-content">
|
||||
<Logo size={24} fill="currentColor" stroke={false}/>
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
{crumbs.map(crumb => (
|
||||
<React.Fragment key={crumb[1]}>
|
||||
<li className="text-base-content">»</li>
|
||||
<li>
|
||||
{crumb[2]
|
||||
? (
|
||||
<Link href={crumb[1]}>
|
||||
<a title={crumb[0]} className="text-secondary hover:text-secondary-focus">
|
||||
{crumb[0]}
|
||||
</a>
|
||||
</Link>
|
||||
)
|
||||
: <span className="text-base-content">{crumb[0]}</span>
|
||||
}
|
||||
</li>
|
||||
</React.Fragment>
|
||||
))}
|
||||
</ul>
|
||||
)
|
||||
}
|
||||
|
||||
const DefaultLayout = ({ app, title=false, children=[] }) => {
|
||||
const router = useRouter()
|
||||
const slug = router.asPath.slice(1)
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import React from 'react'
|
||||
import { useRouter } from 'next/router'
|
||||
import Link from 'next/link'
|
||||
import Aside from 'shared/components/navigation/aside'
|
||||
|
||||
const DocsLayout = ({ app, title=false, children=[] }) => (
|
||||
|
|
|
@ -3,15 +3,12 @@ import { useState } from 'react'
|
|||
import useLocalStorage from 'shared/hooks/useLocalStorage.js'
|
||||
// Locale and translation
|
||||
import { useRouter } from 'next/router'
|
||||
import { useTranslation } from 'next-i18next'
|
||||
import { capitalize } from 'shared/utils.mjs'
|
||||
import useTheme from 'shared/hooks/useTheme'
|
||||
|
||||
function useApp(full = true) {
|
||||
|
||||
// Load translation method
|
||||
const locale = useRouter().locale
|
||||
const { t } = useTranslation(['app'])
|
||||
|
||||
// Persistent state
|
||||
const [account, setAccount] = useLocalStorage('account', { username: false })
|
||||
|
|
|
@ -3,9 +3,6 @@ import useApp from 'site/hooks/useApp.js'
|
|||
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
|
||||
import Layout from 'site/components/layouts/docs'
|
||||
import { useTranslation } from 'next-i18next'
|
||||
import ConfigIcon from 'shared/components/icons/settings'
|
||||
import CogIcon from 'shared/components/icons/cog'
|
||||
import HeartIcon from 'shared/components/icons/heart'
|
||||
import FsIcon from 'shared/components/icons/freesewing'
|
||||
import Link from 'next/link'
|
||||
import Popout from 'shared/components/popout'
|
||||
|
@ -13,9 +10,7 @@ import LocaleIcon from 'shared/components/icons/i18n.js'
|
|||
import { useRouter } from 'next/router'
|
||||
import themes from 'shared/themes/index.js'
|
||||
|
||||
const gh = `<a class="text-secondary hover:text-secondary-focus"
|
||||
href="https://github.com/freesewing/freesewing">freesewing/freesewing</a>`
|
||||
const fsd = `<a class="text-secondary hover:text-secondary-focus"
|
||||
const fsd = `<a class="text-secondary hover:text-secondary-focus"
|
||||
href="https://freesewing.dev">freesewing.dev</a>`
|
||||
|
||||
const translations = {
|
||||
|
@ -83,8 +78,8 @@ const HomePage = (props) => {
|
|||
<h2>{t('patrons:supportFreesewing')}</h2>
|
||||
<div className="flex flex-row flex-wrap gap-2">
|
||||
<div>
|
||||
<p className="max-w-3xl">{t('patrons:patronLead')}</p>
|
||||
<p className="max-w-3xl">{t('patrons:patronPitch')}</p>
|
||||
<p className="max-w-3xl">{t('patrons:patronLead')}</p>
|
||||
<p className="max-w-3xl">{t('patrons:patronPitch')}</p>
|
||||
</div>
|
||||
<a className="btn btn-accent btn-lg ">
|
||||
<span role='image' className="text-4xl px-4">🥰</span>
|
||||
|
|
|
@ -4,15 +4,14 @@ import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
|
|||
import Layout from 'site/components/layouts/docs'
|
||||
import { useTranslation } from 'next-i18next'
|
||||
import DiscordIcon from 'shared/components/icons/discord'
|
||||
import Popout from 'shared/components/popout'
|
||||
import GithubIcon from 'shared/components/icons/github'
|
||||
import CcIcon from 'shared/components/icons/community'
|
||||
import HeartIcon from 'shared/components/icons/heart'
|
||||
import DocsIcon from 'shared/components/icons/docs'
|
||||
|
||||
const gh = `<a class="text-secondary hover:text-secondary-focus"
|
||||
const gh = `<a class="text-secondary hover:text-secondary-focus"
|
||||
href="https://github.com/freesewing/freesewing">freesewing/freesewing</a>`
|
||||
const fsd = `<a class="text-secondary hover:text-secondary-focus"
|
||||
const fsd = `<a class="text-secondary hover:text-secondary-focus"
|
||||
href="https://freesewing.dev">freesewing.dev</a>`
|
||||
|
||||
const translations = {
|
||||
|
@ -23,9 +22,9 @@ const translations = {
|
|||
of gewoon een leuke tijd te spenderen met andere leden van de FreeSewing gemeenschap.`,
|
||||
},
|
||||
github: {
|
||||
en: `For bug reports, please create an issue in the ${gh} repository on Github.
|
||||
en: `For bug reports, please create an issue in the ${gh} repository on Github.
|
||||
This is also where you'll find all our source code.`,
|
||||
nl: `Een bug gevonden? Maak dan een issue aan in de ${gh} repository op Github.
|
||||
nl: `Een bug gevonden? Maak dan een issue aan in de ${gh} repository op Github.
|
||||
Dit is ook waar je al de FreeSewing broncode kan vinden.`,
|
||||
},
|
||||
cc: {
|
||||
|
@ -35,16 +34,9 @@ const translations = {
|
|||
vrijwilligers de lopende zaken bespreken. Ook de plannen voor de toekomst en groot en klein
|
||||
nieuws over FreeSewing en de gemeenschap komen aan bod.`
|
||||
},
|
||||
cc: {
|
||||
en: `Every two weeks, there's the FreeSewing contributor call, which is when we discuss
|
||||
ongoing issues, future plans, and news big and small about FreeSewing and its community.`,
|
||||
nl: `Elke twee weken is er de FreeSewing contributor call (Engelstalig), waar de FreeSewing
|
||||
vrijwilligers de lopende zaken bespreken. Ook de plannen voor de toekomst en groot en klein
|
||||
nieuws over FreeSewing en de gemeenschap komen aan bod.`
|
||||
},
|
||||
docs: {
|
||||
en: `Our documentation for developers hosted on ${fsd}. You can find guides and how-to's
|
||||
there, as well as reference documantation for FreeSewing's core API.
|
||||
en: `Our documentation for developers hosted on ${fsd}. You can find guides and how-to's
|
||||
there, as well as reference documantation for FreeSewing's core API.
|
||||
<br /> <br />
|
||||
We stive to provide excellent documentation. So if something is not clear please, let us know.`,
|
||||
nl: `Onze documentatie voor ontwikkelaars is beschikbaar op ${fsd}. Je vindt er guides en how-to's,
|
||||
|
@ -75,7 +67,7 @@ const SupportPage = (props) => {
|
|||
|
||||
<h2>Github</h2>
|
||||
<div className="flex flex-row flex-wrap gap-2">
|
||||
<p className="max-w-3xl"
|
||||
<p className="max-w-3xl"
|
||||
dangerouslySetInnerHTML={{__html: translations.github[app.locale]}}/>
|
||||
<a className="btn btn-primary btn-outline btn-lg w-96"
|
||||
href="https://github.com/freesewing/freesewing">
|
||||
|
@ -86,7 +78,7 @@ const SupportPage = (props) => {
|
|||
|
||||
<h2>{t('docs')}</h2>
|
||||
<div className="flex flex-row flex-wrap gap-2">
|
||||
<p className="max-w-3xl"
|
||||
<p className="max-w-3xl"
|
||||
dangerouslySetInnerHTML={{__html: translations.docs[app.locale]}}/>
|
||||
<a className="btn btn-primary btn-outline btn-lg w-96"
|
||||
href="https://freesewing.dev/">
|
||||
|
@ -97,7 +89,7 @@ const SupportPage = (props) => {
|
|||
|
||||
<h2>Contributor Calls</h2>
|
||||
<div className="flex flex-row flex-wrap gap-2">
|
||||
<p className="max-w-3xl"
|
||||
<p className="max-w-3xl"
|
||||
dangerouslySetInnerHTML={{__html: translations.cc[app.locale]}}/>
|
||||
<a className="btn btn-primary btn-outline btn-lg w-96"
|
||||
href="https://github.com/freesewing/freesewing/discussions?discussions_q=label%3A%22%3Atv%3A+fscc%22">
|
||||
|
@ -111,8 +103,8 @@ const SupportPage = (props) => {
|
|||
<h2>{t('patrons:supportFreesewing')}</h2>
|
||||
<div className="flex flex-row flex-wrap gap-2">
|
||||
<div>
|
||||
<p className="max-w-3xl">{t('patrons:patronLead')}</p>
|
||||
<p className="max-w-3xl">{t('patrons:patronPitch')}</p>
|
||||
<p className="max-w-3xl">{t('patrons:patronLead')}</p>
|
||||
<p className="max-w-3xl">{t('patrons:patronPitch')}</p>
|
||||
</div>
|
||||
<a className="btn btn-accent btn-lg w-96">
|
||||
<HeartIcon className="fill-accent-content stroke-accent-content w-6 h-6"/>
|
||||
|
|
|
@ -7,9 +7,6 @@ import mustache from 'mustache'
|
|||
import { execSync } from 'child_process'
|
||||
// Software
|
||||
import designs from '../config/software/designs.json'
|
||||
import packages from '../config/software//packages.json'
|
||||
import plugins from '../config/software//plugins.json'
|
||||
import sites from '../config/software//sites.json'
|
||||
|
||||
const type = process.argv[2]
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import glob from 'glob'
|
|||
import yaml from 'js-yaml'
|
||||
import chalk from 'chalk'
|
||||
import mustache from 'mustache'
|
||||
import { capitalize } from '../sites/shared/utils.mjs'
|
||||
import conf from '../lerna.json'
|
||||
const { version } = conf
|
||||
import {
|
||||
|
@ -81,18 +80,18 @@ for (const pkg of Object.values(software)) {
|
|||
}
|
||||
fs.writeFileSync(
|
||||
path.join(cwd, pkg.folder, pkg.name, 'CHANGELOG.md'),
|
||||
changelog(pkg, repo)
|
||||
changelog(pkg)
|
||||
)
|
||||
}
|
||||
log.write(chalk.green(" Done\n"))
|
||||
|
||||
// Step 3: Generate overall CHANGELOG.md
|
||||
// Step 4: Generate overall CHANGELOG.md
|
||||
fs.writeFileSync(
|
||||
path.join(repo.path, 'CHANGELOG.md'),
|
||||
changelog('global', repo)
|
||||
changelog('global')
|
||||
)
|
||||
|
||||
// Step 6: Generate build script for published software
|
||||
// Step 5: Generate build script for published software
|
||||
log.write(chalk.blueBright('Generating buildall node script...'))
|
||||
const buildSteps = buildOrder.map((step, i) => `lerna run cibuild_step${i}`);
|
||||
const buildAllCommand = buildSteps.join(' && ');
|
||||
|
@ -104,7 +103,7 @@ fs.writeFileSync(
|
|||
)
|
||||
log.write(chalk.green(" Done\n"))
|
||||
|
||||
// Step 7: Generate tests for designs and plugins
|
||||
// Step 6: Generate tests for designs and plugins
|
||||
|
||||
|
||||
|
||||
|
@ -435,38 +434,3 @@ function validate() {
|
|||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts a package.json, build.js, README.md, and CHANGELOG.md
|
||||
* into every subdirectory under the packages directory.
|
||||
* Also adds unit tests for patterns, and writes the global CHANGELOG.md.
|
||||
*/
|
||||
function reconfigure(pkgs, repo) {
|
||||
for (const pkg of pkgs) {
|
||||
console.log(chalk.blueBright(`Reconfiguring ${pkg}`))
|
||||
//if (repo.exceptions.customPackageJson.indexOf(pkg) === -1) {
|
||||
// const pkgConfig = packageConfig(pkg, repo)
|
||||
// fs.writeFileSync(
|
||||
// path.join(repo.path, 'packages', pkg, 'package.json'),
|
||||
// JSON.stringify(pkgConfig, null, 2) + '\n'
|
||||
// )
|
||||
//}
|
||||
//if (repo.exceptions.customBuild.indexOf(pkg) === -1) {
|
||||
// fs.writeFileSync(
|
||||
// path.join(repo.path, 'packages', pkg, 'build.js'),
|
||||
// repo.templates.build
|
||||
// )
|
||||
//}
|
||||
//if (repo.exceptions.customReadme.indexOf(pkg) === -1) {
|
||||
// fs.writeFileSync(path.join(repo.path, 'packages', pkg, 'README.md'), readme(pkg, repo))
|
||||
//}
|
||||
if (repo.exceptions.customChangelog.indexOf(pkg) === -1) {
|
||||
fs.writeFileSync(
|
||||
path.join(repo.path, 'packages', pkg, 'CHANGELOG.md'),
|
||||
changelog(pkg, repo)
|
||||
)
|
||||
}
|
||||
const type = packageType(pkg, repo)
|
||||
}
|
||||
fs.writeFileSync(path.join(repo.path, 'CHANGELOG.md'), changelog('global', repo))
|
||||
console.log(chalk.yellowBright.bold('All done.'))
|
||||
}
|
||||
|
|
|
@ -66,7 +66,6 @@ const bearer = token => ({
|
|||
* Exported because it's re-used by the Algolia indexing script
|
||||
*/
|
||||
const getContent = async (lang, type) => {
|
||||
const items = {}
|
||||
let res
|
||||
try {
|
||||
res = await axios.get(`${uris[type]}&_locale=${lang}`)
|
||||
|
@ -82,7 +81,7 @@ const getContent = async (lang, type) => {
|
|||
/*
|
||||
* Adds maker to showcase post
|
||||
*/
|
||||
const addMaker = (content, lang, token, makers) => {
|
||||
const addMaker = (content, token, makers) => {
|
||||
const promises = []
|
||||
for (const item of content) {
|
||||
promises.push(axios.put(
|
||||
|
@ -112,7 +111,7 @@ const addAuthors = async (type, token) => {
|
|||
|
||||
for (const lang of languages) {
|
||||
const content = await getContent(lang, type)
|
||||
if (type === 'showcaseposts') await addMaker(content, lang, token, makers)
|
||||
if (type === 'showcaseposts') await addMaker(content, token, makers)
|
||||
}
|
||||
|
||||
return false
|
||||
|
@ -133,7 +132,6 @@ const getToWork = async () => {
|
|||
console.log('Failed to login to strapi')
|
||||
process.exit()
|
||||
}
|
||||
const translations = languages.length - 1
|
||||
for (const type of Object.keys(uris)) {
|
||||
console.log(`Loading ${type} from Strapi`)
|
||||
await addAuthors(type, token)
|
||||
|
|
|
@ -246,7 +246,6 @@ const getToWork = async () => {
|
|||
process.exit()
|
||||
}
|
||||
const content = {}
|
||||
const translations = languages.length - 1
|
||||
for (const type of Object.keys(uris)) {
|
||||
console.log(`Loading ${type} from Strapi`)
|
||||
content[type] = await getContent(type)
|
||||
|
|
|
@ -3,10 +3,7 @@ import OsiLogo from 'shared/components/logos/osi.js'
|
|||
import CreativeCommonsLogo from 'shared/components/logos/cc.js'
|
||||
import CcByLogo from 'shared/components/logos/cc-by.js'
|
||||
import { useTranslation } from 'next-i18next'
|
||||
import PageLink from 'shared/components/page-link'
|
||||
import DocsLink from 'shared/components/docs-link'
|
||||
import PinkedRibbon from 'shared/components/pinked-ribbon.js'
|
||||
import Worm from 'shared/components/worm.js'
|
||||
import Link from 'next/link'
|
||||
|
||||
import DiscordIcon from 'shared/components/icons/discord.js'
|
||||
|
|
|
@ -1,59 +1,7 @@
|
|||
import React from 'react'
|
||||
import { useRouter } from 'next/router'
|
||||
import Link from 'next/link'
|
||||
// Shared components
|
||||
import Logo from 'shared/components/logos/freesewing.js'
|
||||
import Aside from 'shared/components/navigation/aside'
|
||||
import get from 'lodash.get'
|
||||
import ThemePicker from 'shared/components/theme-picker'
|
||||
|
||||
const PageTitle = ({ app, slug, title }) => {
|
||||
if (title) return <h1>{title}</h1>
|
||||
if (slug) return <h1>{get(app.navigation, slug.split('/')).__title}</h1>
|
||||
|
||||
return <h1>FIXME: This page has no title</h1>
|
||||
}
|
||||
|
||||
const Breadcrumbs = ({ app, slug=false, title }) => {
|
||||
if (!slug) return null
|
||||
const crumbs = []
|
||||
const chunks = slug.split('/')
|
||||
for (const i in chunks) {
|
||||
const j = parseInt(i)+parseInt(1)
|
||||
const page = get(app.navigation, chunks.slice(0,j))
|
||||
if (page) crumbs.push([page.__linktitle, '/'+chunks.slice(0,j).join('/'), (j < chunks.length)])
|
||||
}
|
||||
|
||||
return (
|
||||
<ul className="flex flex-row flex-wrap gap-2 font-bold">
|
||||
<li>
|
||||
<Link href="/">
|
||||
<a title="To the homepage" className="text-base-content">
|
||||
<Logo size={24} fill="currentColor" stroke={false}/>
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
{crumbs.map(crumb => (
|
||||
<React.Fragment key={crumb[1]}>
|
||||
<li className="text-base-content">»</li>
|
||||
<li>
|
||||
{crumb[2]
|
||||
? (
|
||||
<Link href={crumb[1]}>
|
||||
<a title={crumb[0]} className="text-secondary hover:text-secondary-focus">
|
||||
{crumb[0]}
|
||||
</a>
|
||||
</Link>
|
||||
)
|
||||
: <span className="text-base-content">{crumb[0]}</span>
|
||||
}
|
||||
</li>
|
||||
</React.Fragment>
|
||||
))}
|
||||
</ul>
|
||||
)
|
||||
}
|
||||
|
||||
const DefaultLayout = ({ app, title=false, children=[] }) => {
|
||||
const router = useRouter()
|
||||
const slug = router.asPath.slice(1)
|
||||
|
|
|
@ -20,10 +20,7 @@ const DefaultLayout = ({ app, title=false, crumbs=false, children=[] }) => {
|
|||
{title && (
|
||||
<>
|
||||
<Breadcrumbs title={title} crumbs={breadcrumbs} />
|
||||
{title
|
||||
? <h1>{title}</h1>
|
||||
: <h1>{app.getTitle(slug)}</h1>
|
||||
}
|
||||
<h1>{title}</h1>
|
||||
</>
|
||||
)}
|
||||
{children}
|
||||
|
|
|
@ -25,7 +25,6 @@ const LayoutWrapper = ({
|
|||
const router = useRouter()
|
||||
router.events?.on('routeChangeStart', startNavigation)
|
||||
router.events?.on('routeChangeComplete', () => app.stopLoading())
|
||||
const slug = router.asPath.slice(1)
|
||||
const [collapsePrimaryNav, setCollapsePrimaryNav] = useState(workbench || false)
|
||||
const [collapseAltMenu, setCollapseAltMenu] = useState(false)
|
||||
|
||||
|
|
|
@ -8,10 +8,6 @@ import Docs from 'site/components/layouts/docs'
|
|||
// Add feeds
|
||||
import Feeds from 'site/components/feeds.js'
|
||||
|
||||
const layouts = {
|
||||
docs: Docs,
|
||||
}
|
||||
|
||||
/* This component should wrap all page content */
|
||||
const PageWrapper= ({
|
||||
title="FIXME: No title set",
|
||||
|
|
|
@ -4,11 +4,9 @@ import { banner } from '../../scripts/banner.mjs'
|
|||
|
||||
const config = configBuilder('dev')
|
||||
config.i18n = i18nConfig.i18n
|
||||
let greeting = false
|
||||
if (!greeting) {
|
||||
greeting = true
|
||||
console.log(banner+"\n")
|
||||
}
|
||||
|
||||
// Say hi
|
||||
console.log(banner+"\n")
|
||||
|
||||
// Suppress warnings about importing version from package.json
|
||||
// We'll deal with it in v3 of FreeSewing
|
||||
|
|
|
@ -3,16 +3,12 @@ import useApp from 'site/hooks/useApp.js'
|
|||
import TimeAgo from 'react-timeago'
|
||||
import MdxWrapper from 'shared/components/wrappers/mdx'
|
||||
import mdxCompiler from 'shared/mdx/compiler'
|
||||
import Markdown from 'react-markdown'
|
||||
import Head from 'next/head'
|
||||
import Lightbox from 'shared/components/lightbox.js'
|
||||
import ImageWrapper from 'shared/components/wrappers/img.js'
|
||||
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
|
||||
import { strapiHost } from 'shared/config/freesewing.mjs'
|
||||
import { strapiImage } from 'shared/utils'
|
||||
import { useTranslation } from 'next-i18next'
|
||||
|
||||
const strapi = "https://posts.freesewing.org"
|
||||
|
||||
const Author = ({ author }) => (
|
||||
<div id="author" className="flex flex-col lg:flex-row m-auto p-2 items-center">
|
||||
|
|
|
@ -2,10 +2,9 @@ import Page from 'site/components/wrappers/page.js'
|
|||
import useApp from 'site/hooks/useApp.js'
|
||||
import Head from 'next/head'
|
||||
import HelpUs from 'site/components/help-us.js'
|
||||
import Link from 'next/link'
|
||||
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
|
||||
import Layout from 'site/components/layouts/bare'
|
||||
import Navigation, { Icons } from 'shared/components/navigation/primary'
|
||||
import { Icons } from 'shared/components/navigation/primary'
|
||||
import Highlight from 'shared/components/mdx/highlight'
|
||||
import Popout from 'shared/components/popout'
|
||||
import WebLink from 'shared/components/web-link'
|
||||
|
|
|
@ -142,7 +142,7 @@ const indexMarkdownContent = async () => {
|
|||
|
||||
const run = async () => {
|
||||
if (
|
||||
(process.env.NETLIFY && process.env.CONTEXT === 'production' && false) // disabled for now
|
||||
(process.env.NETLIFY && process.env.CONTEXT === 'production')
|
||||
|| process.env.FORCE_ALGOLIA
|
||||
) {
|
||||
await indexMarkdownContent()
|
||||
|
|
|
@ -15,8 +15,6 @@ import TwitterIcon from 'shared/components/icons/twitter.js'
|
|||
|
||||
// Classes
|
||||
const link = "text-secondary font-bold hover:pointer hover:underline px-1"
|
||||
const accent = "text-accent font-bold text-lg px-1 block sm:inline"
|
||||
const freesewing = "px-1 text-lg font-bold block sm:inline"
|
||||
|
||||
// Keep these translations in the component because they're only used here
|
||||
const translations = {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { useState, useEffect } from 'react'
|
||||
import Logo from 'shared/components/logos/freesewing.js'
|
||||
import Link from 'next/link'
|
||||
import ThemePicker from 'shared/components/theme-picker.js'
|
||||
import LocalePicker from 'shared/components/locale-picker.js'
|
||||
|
|
|
@ -1,58 +1,7 @@
|
|||
import React from 'react'
|
||||
import { useRouter } from 'next/router'
|
||||
import Link from 'next/link'
|
||||
// Shared components
|
||||
import Logo from 'shared/components/logos/freesewing.js'
|
||||
import Aside from 'shared/components/navigation/aside'
|
||||
import get from 'lodash.get'
|
||||
import { BeforeNav } from './lab'
|
||||
|
||||
const PageTitle = ({ app, slug, title }) => {
|
||||
if (title) return <h1>{title}</h1>
|
||||
if (slug) return <h1>{get(app.navigation, slug.split('/')).__title}</h1>
|
||||
|
||||
return <h1>FIXME: This page has no title</h1>
|
||||
}
|
||||
|
||||
const Breadcrumbs = ({ app, slug=false, title }) => {
|
||||
if (!slug) return null
|
||||
const crumbs = []
|
||||
const chunks = slug.split('/')
|
||||
for (const i in chunks) {
|
||||
const j = parseInt(i)+parseInt(1)
|
||||
const page = get(app.navigation, chunks.slice(0,j))
|
||||
if (page) crumbs.push([page.__linktitle, '/'+chunks.slice(0,j).join('/'), (j < chunks.length)])
|
||||
}
|
||||
|
||||
return (
|
||||
<ul className="flex flex-row flex-wrap gap-2 font-bold">
|
||||
<li>
|
||||
<Link href="/">
|
||||
<a title="To the homepage" className="text-base-content">
|
||||
<Logo size={24} fill="currentColor" stroke={false}/>
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
{crumbs.map(crumb => (
|
||||
<React.Fragment key={crumb[1]}>
|
||||
<li className="text-base-content">»</li>
|
||||
<li>
|
||||
{crumb[2]
|
||||
? (
|
||||
<Link href={crumb[1]}>
|
||||
<a title={crumb[0]} className="text-secondary hover:text-secondary-focus">
|
||||
{crumb[0]}
|
||||
</a>
|
||||
</Link>
|
||||
)
|
||||
: <span className="text-base-content">{crumb[0]}</span>
|
||||
}
|
||||
</li>
|
||||
</React.Fragment>
|
||||
))}
|
||||
</ul>
|
||||
)
|
||||
}
|
||||
|
||||
const DefaultLayout = ({ app, title=false, children=[] }) => {
|
||||
const router = useRouter()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue